Skip to content

Commit 4b768f6

Browse files
Amos Mastbaumclaude
andcommitted
fix(tkn): properly wire compute-families for eks/kind/windows; drop from mac
- eks, kind, windows: add compute-sizes + cpus/memory params and wire compute-sizes/else conditional in script so --compute-families is actually passed to the CLI (all three targets support the flag) - mac: remove compute-families param — mac uses dedicated host provisioning and the CLI does not accept the flag - Update TestComputeFamiliesParamDefined to skip mac - Add eks, kind, windows to TestComputeFamiliesPassedInScript Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
1 parent df3c818 commit 4b768f6

9 files changed

Lines changed: 111 additions & 14 deletions

pkg/tkn/compute_families_test.go

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,18 @@ import (
1010
// Tasks that have a compute-sizes conditional in their script and must also
1111
// conditionally pass --compute-families in the else branch.
1212
var tasksWithComputeFamiliesScript = map[string]struct{}{
13-
"infra-aws-rhel.yaml": {},
14-
"infra-aws-ocp-snc.yaml": {},
15-
"infra-aws-fedora.yaml": {},
16-
"infra-aws-rhel-ai.yaml": {},
13+
"infra-aws-rhel.yaml": {},
14+
"infra-aws-ocp-snc.yaml": {},
15+
"infra-aws-fedora.yaml": {},
16+
"infra-aws-rhel-ai.yaml": {},
17+
"infra-aws-eks.yaml": {},
18+
"infra-aws-kind.yaml": {},
19+
"infra-aws-windows-server.yaml": {},
20+
}
21+
22+
// mac uses dedicated host provisioning — CLI does not accept --compute-families.
23+
var tasksWithoutComputeFamiliesParam = map[string]struct{}{
24+
"infra-aws-mac.yaml": {},
1725
}
1826

1927
func TestComputeFamiliesParamDefined(t *testing.T) {
@@ -28,6 +36,9 @@ func TestComputeFamiliesParamDefined(t *testing.T) {
2836
if !isAWSInfraTask(name) {
2937
continue
3038
}
39+
if _, skip := tasksWithoutComputeFamiliesParam[name]; skip {
40+
continue
41+
}
3142
path := filepath.Join(root, dir, name)
3243
data, err := os.ReadFile(path)
3344
if err != nil {

tkn/infra-aws-eks.yaml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,9 +102,18 @@ spec:
102102
- name: load-balancer-controller
103103
description: Install AWS Load Balancer Controller (default false)
104104
default: 'false'
105+
- name: compute-sizes
106+
description: Comma seperated list of sizes for the machines to be requested. If set this takes precedence over compute by args
107+
default: ""
105108
- name: compute-families
106109
description: Comma-separated allowlist of AWS instance family prefixes (e.g. m5,m6i,m7i). Empty means no restriction. Only used when compute-sizes is not set.
107110
default: ""
111+
- name: cpus
112+
description: Number of CPUs for the cloud instance (default 8)
113+
default: '8'
114+
- name: memory
115+
description: Amount of RAM for the cloud instance in GiB (default 64)
116+
default: '64'
108117

109118
# Spot params
110119
- name: spot
@@ -219,6 +228,15 @@ spec:
219228
cmd+="--conn-details-output /opt/cluster-info "
220229
cmd+="--version $(params.k8s-version) "
221230
cmd+="--arch $(params.arch) "
231+
if [[ $(params.compute-sizes) != "" ]]; then
232+
cmd+="--compute-sizes $(params.compute-sizes) "
233+
else
234+
cmd+="--cpus $(params.cpus) "
235+
cmd+="--memory $(params.memory) "
236+
if [[ $(params.compute-families) != "" ]]; then
237+
cmd+="--compute-families $(params.compute-families) "
238+
fi
239+
fi
222240
cmd+="--workers-desired $(params.workers-desired) "
223241
cmd+="--workers-max $(params.workers-max) "
224242
cmd+="--workers-min $(params.workers-min) "

tkn/infra-aws-kind.yaml

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,9 @@ spec:
9191
- name: memory
9292
description: Amount of RAM for the cloud instance in GiB (default 64)
9393
default: '64'
94+
- name: compute-sizes
95+
description: Comma seperated list of sizes for the machines to be requested. If set this takes precedence over compute by args
96+
default: ""
9497
- name: compute-families
9598
description: Comma-separated allowlist of AWS instance family prefixes (e.g. m5,m6i,m7i). Empty means no restriction. Only used when compute-sizes is not set.
9699
default: ""
@@ -223,8 +226,15 @@ spec:
223226
if [[ $(params.operation) == "create" ]]; then
224227
cmd+="--conn-details-output /opt/cluster-info "
225228
cmd+="--arch $(params.arch) "
226-
cmd+="--cpus $(params.cpus) "
227-
cmd+="--memory $(params.memory) "
229+
if [[ $(params.compute-sizes) != "" ]]; then
230+
cmd+="--compute-sizes $(params.compute-sizes) "
231+
else
232+
cmd+="--cpus $(params.cpus) "
233+
cmd+="--memory $(params.memory) "
234+
if [[ $(params.compute-families) != "" ]]; then
235+
cmd+="--compute-families $(params.compute-families) "
236+
fi
237+
fi
228238
if [[ $(params.nested-virt) == "true" ]]; then
229239
cmd+="--nested-virt "
230240
fi

tkn/infra-aws-mac.yaml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -99,9 +99,6 @@ spec:
9999
- name: fixed-location
100100
description: if this flag is set the host will be created only on the region set by the AWS Env (AWS_DEFAULT_REGION).
101101
default: 'false'
102-
- name: compute-families
103-
description: Comma-separated allowlist of AWS instance family prefixes (e.g. m5,m6i,m7i). Empty means no restriction. Only used when compute-sizes is not set.
104-
default: ""
105102

106103
# Topology params
107104
- name: airgap

tkn/infra-aws-windows-server.yaml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,9 +106,18 @@ spec:
106106
- name: disk-size
107107
description: Disk size in GB for the cloud instance
108108
default: '200'
109+
- name: compute-sizes
110+
description: Comma seperated list of sizes for the machines to be requested. If set this takes precedence over compute by args
111+
default: ""
109112
- name: compute-families
110113
description: Comma-separated allowlist of AWS instance family prefixes (e.g. m5,m6i,m7i). Empty means no restriction. Only used when compute-sizes is not set.
111114
default: ""
115+
- name: cpus
116+
description: Number of CPUs for the cloud instance (default 8)
117+
default: '8'
118+
- name: memory
119+
description: Amount of RAM for the cloud instance in GiB (default 64)
120+
default: '200'
112121

113122
- name: airgap
114123
description: |
@@ -237,6 +246,15 @@ spec:
237246
cmd+="--ami-owner $(params.ami-owner) "
238247
cmd+="--ami-lang $(params.ami-lang) "
239248
cmd+="--disk-size $(params.disk-size) "
249+
if [[ $(params.compute-sizes) != "" ]]; then
250+
cmd+="--compute-sizes $(params.compute-sizes) "
251+
else
252+
cmd+="--cpus $(params.cpus) "
253+
cmd+="--memory $(params.memory) "
254+
if [[ $(params.compute-families) != "" ]]; then
255+
cmd+="--compute-families $(params.compute-families) "
256+
fi
257+
fi
240258
if [[ $(params.spot) == "true" ]]; then
241259
cmd+="--spot --spot-increase-rate $(params.spot-increase-rate) --spot-eviction-tolerance $(params.spot-eviction-tolerance) "
242260
fi

tkn/template/infra-aws-eks.yaml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,9 +102,18 @@ spec:
102102
- name: load-balancer-controller
103103
description: Install AWS Load Balancer Controller (default false)
104104
default: 'false'
105+
- name: compute-sizes
106+
description: Comma seperated list of sizes for the machines to be requested. If set this takes precedence over compute by args
107+
default: ""
105108
- name: compute-families
106109
description: Comma-separated allowlist of AWS instance family prefixes (e.g. m5,m6i,m7i). Empty means no restriction. Only used when compute-sizes is not set.
107110
default: ""
111+
- name: cpus
112+
description: Number of CPUs for the cloud instance (default 8)
113+
default: '8'
114+
- name: memory
115+
description: Amount of RAM for the cloud instance in GiB (default 64)
116+
default: '64'
108117

109118
# Spot params
110119
- name: spot
@@ -219,6 +228,15 @@ spec:
219228
cmd+="--conn-details-output /opt/cluster-info "
220229
cmd+="--version $(params.k8s-version) "
221230
cmd+="--arch $(params.arch) "
231+
if [[ $(params.compute-sizes) != "" ]]; then
232+
cmd+="--compute-sizes $(params.compute-sizes) "
233+
else
234+
cmd+="--cpus $(params.cpus) "
235+
cmd+="--memory $(params.memory) "
236+
if [[ $(params.compute-families) != "" ]]; then
237+
cmd+="--compute-families $(params.compute-families) "
238+
fi
239+
fi
222240
cmd+="--workers-desired $(params.workers-desired) "
223241
cmd+="--workers-max $(params.workers-max) "
224242
cmd+="--workers-min $(params.workers-min) "

tkn/template/infra-aws-kind.yaml

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,9 @@ spec:
9191
- name: memory
9292
description: Amount of RAM for the cloud instance in GiB (default 64)
9393
default: '64'
94+
- name: compute-sizes
95+
description: Comma seperated list of sizes for the machines to be requested. If set this takes precedence over compute by args
96+
default: ""
9497
- name: compute-families
9598
description: Comma-separated allowlist of AWS instance family prefixes (e.g. m5,m6i,m7i). Empty means no restriction. Only used when compute-sizes is not set.
9699
default: ""
@@ -223,8 +226,15 @@ spec:
223226
if [[ $(params.operation) == "create" ]]; then
224227
cmd+="--conn-details-output /opt/cluster-info "
225228
cmd+="--arch $(params.arch) "
226-
cmd+="--cpus $(params.cpus) "
227-
cmd+="--memory $(params.memory) "
229+
if [[ $(params.compute-sizes) != "" ]]; then
230+
cmd+="--compute-sizes $(params.compute-sizes) "
231+
else
232+
cmd+="--cpus $(params.cpus) "
233+
cmd+="--memory $(params.memory) "
234+
if [[ $(params.compute-families) != "" ]]; then
235+
cmd+="--compute-families $(params.compute-families) "
236+
fi
237+
fi
228238
if [[ $(params.nested-virt) == "true" ]]; then
229239
cmd+="--nested-virt "
230240
fi

tkn/template/infra-aws-mac.yaml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -99,9 +99,6 @@ spec:
9999
- name: fixed-location
100100
description: if this flag is set the host will be created only on the region set by the AWS Env (AWS_DEFAULT_REGION).
101101
default: 'false'
102-
- name: compute-families
103-
description: Comma-separated allowlist of AWS instance family prefixes (e.g. m5,m6i,m7i). Empty means no restriction. Only used when compute-sizes is not set.
104-
default: ""
105102

106103
# Topology params
107104
- name: airgap

tkn/template/infra-aws-windows-server.yaml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,9 +106,18 @@ spec:
106106
- name: disk-size
107107
description: Disk size in GB for the cloud instance
108108
default: '200'
109+
- name: compute-sizes
110+
description: Comma seperated list of sizes for the machines to be requested. If set this takes precedence over compute by args
111+
default: ""
109112
- name: compute-families
110113
description: Comma-separated allowlist of AWS instance family prefixes (e.g. m5,m6i,m7i). Empty means no restriction. Only used when compute-sizes is not set.
111114
default: ""
115+
- name: cpus
116+
description: Number of CPUs for the cloud instance (default 8)
117+
default: '8'
118+
- name: memory
119+
description: Amount of RAM for the cloud instance in GiB (default 64)
120+
default: '200'
112121

113122
- name: airgap
114123
description: |
@@ -237,6 +246,15 @@ spec:
237246
cmd+="--ami-owner $(params.ami-owner) "
238247
cmd+="--ami-lang $(params.ami-lang) "
239248
cmd+="--disk-size $(params.disk-size) "
249+
if [[ $(params.compute-sizes) != "" ]]; then
250+
cmd+="--compute-sizes $(params.compute-sizes) "
251+
else
252+
cmd+="--cpus $(params.cpus) "
253+
cmd+="--memory $(params.memory) "
254+
if [[ $(params.compute-families) != "" ]]; then
255+
cmd+="--compute-families $(params.compute-families) "
256+
fi
257+
fi
240258
if [[ $(params.spot) == "true" ]]; then
241259
cmd+="--spot --spot-increase-rate $(params.spot-increase-rate) --spot-eviction-tolerance $(params.spot-eviction-tolerance) "
242260
fi

0 commit comments

Comments
 (0)