Skip to content

Commit 6c5067d

Browse files
committed
fix(platform): stop carrying images.kubectl into adopted node pools
Migration 56 copied the parent cluster's kubectl image override into each kubernetes-nodes release it creates. Neither chart reads an images map any more, so the copy only planted an inert key in the pool values. Migration 56 has not shipped in a stable release, so no cluster has run the old mapping outside a pre-release. Assisted-by: LLM Signed-off-by: Andrei Kvapil <[email protected]>
1 parent c82946a commit 6c5067d

2 files changed

Lines changed: 8 additions & 15 deletions

File tree

‎hack/migration-56-adopt-values.bats‎

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
# spec.values from the parent kubernetes HR values with a jq helper:
99
#
1010
# def pick($o; ks): reduce ks[] as $k ({}; if ($o | has($k)) ...);
11-
# ... + pick(.; ["version","talos"]) # images is narrowed to {kubectl} separately
11+
# ... + pick(.; ["version","talos"])
1212
#
1313
# A subtle regression is to write `def pick(o; ks)` with a filter-parameter:
1414
# inside `reduce ks[] as $k ({}; ...)` the `.` context is the accumulator, so
@@ -21,7 +21,7 @@
2121
#
2222
# The @test below drives the REAL migration script against a fake kubectl and
2323
# asserts the captured child HelmRelease carries the tenant's non-default
24-
# talos/version/images (plus the group fields and storageClass fallback). It
24+
# talos/version (plus the group fields and storageClass fallback). It
2525
# fails against the buggy `pick(o; ...)` and passes against `pick($o; ...)`.
2626
#
2727
# cozytest.sh's awk parser recognizes only @test blocks and a bare `}` on its
@@ -35,8 +35,9 @@ FAKEBIN="$PWD/hack/testdata/migration-56"
3535
MIG="$PWD/packages/core/platform/images/migrations/migrations/56"
3636

3737
# prep resets PATH/env to a clean scenario: one tenant Kubernetes HR (test3)
38-
# with a single pool md0 and NON-default talos/version/images so the assertions
39-
# distinguish "copied the tenant value" from "fell back to the chart default".
38+
# with a single pool md0 and NON-default talos/version so the assertions
39+
# distinguish "copied the tenant value" from "fell back to the chart default",
40+
# plus a leftover images map that must not reach the pool values.
4041
prep() {
4142
chmod +x "$FAKEBIN/kubectl"
4243
WORK=$(mktemp -d)
@@ -59,7 +60,7 @@ prep() {
5960
JSON
6061
}
6162

62-
@test "child HR carries the tenant's talos/version/images (not chart defaults) so the KMT hash is preserved" {
63+
@test "child HR carries the tenant's talos/version (not chart defaults) so the KMT hash is preserved" {
6364
prep
6465
rc=0
6566
bash "$MIG" >"$WORK/out" 2>&1 || rc=$?
@@ -80,11 +81,8 @@ JSON
8081
[ "$(jq -r '.spec.values.talos.version' "$FAKE_CHILD_HR")" = "v1.13.0" ]
8182
[ "$(jq -r '.spec.values.talos.schematicID' "$FAKE_CHILD_HR")" = "deadbeef" ]
8283
[ "$(jq -r '.spec.values.version' "$FAKE_CHILD_HR")" = "v1.32" ]
83-
[ "$(jq -r '.spec.values.images.kubectl' "$FAKE_CHILD_HR")" = "example.io/kubectl:v1.32" ]
84-
# images is narrowed to the declared kubectl key only — the parent's
85-
# waitForKubeconfig/talosCsrSigner (undeclared in the KubernetesNodes schema)
86-
# must NOT leak into the adopted pool values.
87-
[ "$(jq -r '.spec.values.images | keys | join(",")' "$FAKE_CHILD_HR")" = "kubectl" ]
84+
# Neither chart reads an images map any more, so none is carried over.
85+
[ "$(jq -r '.spec.values | has("images")' "$FAKE_CHILD_HR")" = "false" ]
8886

8987
# Group fields and the storageClass cluster-level fallback carry through.
9088
[ "$(jq -r '.spec.values.minReplicas' "$FAKE_CHILD_HR")" = "1" ]

‎packages/core/platform/images/migrations/migrations/56‎

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -507,11 +507,6 @@ kubectl get helmrelease --all-namespaces \
507507
+ (if (has("maxNodeProvisionTime") and (.maxNodeProvisionTime != null)) then {maxNodeProvisionTime: .maxNodeProvisionTime} else {} end)
508508
# cluster-level inputs the pool templates consume verbatim
509509
+ pick(.; ["version","talos"])
510-
# images: copy only the declared kubectl override, not the whole
511-
# parent images map (which carries waitForKubeconfig/talosCsrSigner that
512-
# the KubernetesNodes schema does not declare and a dashboard round-trip
513-
# would drop).
514-
+ (if ((.images | type) == "object" and (.images | has("kubectl"))) then {images: {kubectl: .images.kubectl}} else {} end)
515510
)')
516511

517512
# Adopt the worker objects the parent rendered for this group BEFORE

0 commit comments

Comments
 (0)