Skip to content

Commit f2ee3ec

Browse files
test(computeplane): pin the maxUnavailable bounds and zero through the API
A zero dropped anywhere between the ComputePlane API and the pool chart would let a GPU pool fall back to the chart default of 1, and the render tests never cross the aggregated API. A negative value let through by the ComputePlane schema would only be refused by the pool chart, after the parent release had already been upgraded. Assisted-by: LLM Signed-off-by: Mattia Eleuteri <[email protected]>
1 parent 28b66bb commit f2ee3ec

2 files changed

Lines changed: 23 additions & 5 deletions

File tree

‎hack/e2e-chainsaw/computeplane/chainsaw-test.yaml‎

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,9 @@ spec:
102102
#
103103
# nameOverride is outside the module's per-pool allowlist. The ComputePlane
104104
# schema accepts it, so it reaches the module and the pool check below can
105-
# see whether the module dropped it.
105+
# see whether the module dropped it. maxUnavailable is set to 0 because a
106+
# zero lost anywhere on the way would let a GPU pool fall back to the
107+
# chart's default of 1; only this path crosses the aggregated API.
106108
- script:
107109
timeout: 3m
108110
content: |
@@ -118,6 +120,7 @@ spec:
118120
diskSize: 20Gi
119121
instanceType: u1.medium
120122
logSerialConsole: true
123+
maxUnavailable: 0
121124
minReplicas: 2
122125
maxReplicas: 2
123126
podCpuLimit: 2
@@ -175,8 +178,9 @@ spec:
175178
enabled: true
176179
exposeMethod: Proxied
177180

178-
# The pool takes the patched shape, and the nameOverride the patch sent
179-
# does not reach it, nor does any other key outside the allowlist.
181+
# The pool takes the patched shape, the explicit maxUnavailable of 0
182+
# included, and the nameOverride the patch sent does not reach it, nor does
183+
# any other key outside the allowlist.
180184
- script:
181185
timeout: 1m
182186
content: |
@@ -186,8 +190,8 @@ spec:
186190
sc=$(cozy_e2e_storage_class)
187191
values=$(timeout -k 5 30 kubectl -n tenant-cplane get helmrelease kubernetes-nodes-computeplane-cluster-md0 -o json | jq -c '.spec.values')
188192
echo "pool values: $values"
189-
echo "$values" | jq -e --arg sc "$sc" '.storageClass == $sc and .minReplicas == 2 and .cluster == "computeplane-cluster" and .clusterReleaseName == "computeplane-cluster"'
190-
extra=$(echo "$values" | jq -r 'keys - ["cluster","clusterReleaseName","minReplicas","maxReplicas","instanceType","diskSize","storageClass","roles","resources","gpus","kubelet","logSerialConsole","maxUnhealthy","nodeStartupTimeout","readyUnknownTimeout","readyFalseTimeout","podCpuLimit","podCpuRequest","maxNodeProvisionTime"] | .[]')
193+
echo "$values" | jq -e --arg sc "$sc" '.storageClass == $sc and .minReplicas == 2 and .maxUnavailable == 0 and .cluster == "computeplane-cluster" and .clusterReleaseName == "computeplane-cluster"'
194+
extra=$(echo "$values" | jq -r 'keys - ["cluster","clusterReleaseName","minReplicas","maxReplicas","instanceType","diskSize","storageClass","roles","resources","gpus","kubelet","logSerialConsole","maxUnhealthy","nodeStartupTimeout","readyUnknownTimeout","readyFalseTimeout","podCpuLimit","podCpuRequest","maxNodeProvisionTime","maxUnavailable"] | .[]')
191195
if [ -n "$extra" ]; then
192196
echo "pool HelmRelease carries keys outside the module allowlist: $extra" >&2
193197
exit 1

‎packages/extra/computeplane/tests/cluster_test.yaml‎

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -353,6 +353,20 @@ tests:
353353
- failedTemplate:
354354
errorPattern: "maxUnavailable"
355355

356+
- it: refuses a negative maxUnavailable
357+
set:
358+
nodeGroups:
359+
md0:
360+
minReplicas: 1
361+
maxReplicas: 3
362+
instanceType: u1.large
363+
diskSize: 32Gi
364+
roles: ["ingress-nginx"]
365+
maxUnavailable: -1
366+
asserts:
367+
- failedTemplate:
368+
errorPattern: "maxUnavailable"
369+
356370
# Helm caps a HelmRelease name at 53 chars and each pool renders a 38-char fixed
357371
# prefix, so a pool key over 15 chars would create a release the apiserver
358372
# accepts but Flux never reconciles. The render must refuse instead (the same

0 commit comments

Comments
 (0)