From f2ee3ec8ad742649c6359a4d50e94496aa967fce Mon Sep 17 00:00:00 2001 From: Mattia Eleuteri Date: Mon, 9 Nov 2026 13:24:36 +0100 Subject: [PATCH] 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 --- hack/e2e-chainsaw/computeplane/chainsaw-test.yaml | 14 +++++++++----- .../extra/computeplane/tests/cluster_test.yaml | 14 ++++++++++++++ 2 files changed, 23 insertions(+), 5 deletions(-) diff --git a/hack/e2e-chainsaw/computeplane/chainsaw-test.yaml b/hack/e2e-chainsaw/computeplane/chainsaw-test.yaml index 2a02dc06e..a81ff89ef 100644 --- a/hack/e2e-chainsaw/computeplane/chainsaw-test.yaml +++ b/hack/e2e-chainsaw/computeplane/chainsaw-test.yaml @@ -102,7 +102,9 @@ spec: # # nameOverride is outside the module's per-pool allowlist. The ComputePlane # schema accepts it, so it reaches the module and the pool check below can - # see whether the module dropped it. + # see whether the module dropped it. maxUnavailable is set to 0 because a + # zero lost anywhere on the way would let a GPU pool fall back to the + # chart's default of 1; only this path crosses the aggregated API. - script: timeout: 3m content: | @@ -118,6 +120,7 @@ spec: diskSize: 20Gi instanceType: u1.medium logSerialConsole: true + maxUnavailable: 0 minReplicas: 2 maxReplicas: 2 podCpuLimit: 2 @@ -175,8 +178,9 @@ spec: enabled: true exposeMethod: Proxied - # The pool takes the patched shape, and the nameOverride the patch sent - # does not reach it, nor does any other key outside the allowlist. + # The pool takes the patched shape, the explicit maxUnavailable of 0 + # included, and the nameOverride the patch sent does not reach it, nor does + # any other key outside the allowlist. - script: timeout: 1m content: | @@ -186,8 +190,8 @@ spec: sc=$(cozy_e2e_storage_class) values=$(timeout -k 5 30 kubectl -n tenant-cplane get helmrelease kubernetes-nodes-computeplane-cluster-md0 -o json | jq -c '.spec.values') echo "pool values: $values" - echo "$values" | jq -e --arg sc "$sc" '.storageClass == $sc and .minReplicas == 2 and .cluster == "computeplane-cluster" and .clusterReleaseName == "computeplane-cluster"' - 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"] | .[]') + echo "$values" | jq -e --arg sc "$sc" '.storageClass == $sc and .minReplicas == 2 and .maxUnavailable == 0 and .cluster == "computeplane-cluster" and .clusterReleaseName == "computeplane-cluster"' + 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"] | .[]') if [ -n "$extra" ]; then echo "pool HelmRelease carries keys outside the module allowlist: $extra" >&2 exit 1 diff --git a/packages/extra/computeplane/tests/cluster_test.yaml b/packages/extra/computeplane/tests/cluster_test.yaml index 6dc4b8835..ad9af03fd 100644 --- a/packages/extra/computeplane/tests/cluster_test.yaml +++ b/packages/extra/computeplane/tests/cluster_test.yaml @@ -353,6 +353,20 @@ tests: - failedTemplate: errorPattern: "maxUnavailable" + - it: refuses a negative maxUnavailable + set: + nodeGroups: + md0: + minReplicas: 1 + maxReplicas: 3 + instanceType: u1.large + diskSize: 32Gi + roles: ["ingress-nginx"] + maxUnavailable: -1 + asserts: + - failedTemplate: + errorPattern: "maxUnavailable" + # Helm caps a HelmRelease name at 53 chars and each pool renders a 38-char fixed # prefix, so a pool key over 15 chars would create a release the apiserver # accepts but Flux never reconciles. The render must refuse instead (the same