Skip to content

Commit 90f0b04

Browse files
fix(kubernetes)!: remove the talos block the chart no longer uses
The kubernetes chart declared a talos block (version, schematicID, imageFactoryURL, installerRepository, registryMirrors). Workers are KubernetesNodes pools and take every one of these from their own talos values, so an operator who set them on the cluster got no error and no effect. The only reader left was a copy of the Talos to Kubernetes support-matrix check, and the pool chart already runs that check itself, against the Talos release each pool actually boots, including one an osImage override selects. The cluster's copy compared the Kubernetes version against a Talos release no node runs. The block leaves the API schema, hence the "!". Stored specs that still carry it keep rendering: the values schema does not close the object and the API does not validate spec against it. A helm-unittest case pins that. Readers outside the chart moved with it. The e2e install read talos.schematicID from this chart's values.yaml in a best-effort block that only warns, so removing the field would have stopped the image cache being seeded without failing anything; it now reads the pool chart, as the proxmox template script already does. The e2e no longer writes a talos block into the Kubernetes CR, the spec test checks the pool chart for the key it emits, the release checklist diffs the pool chart's pins as well, and the catalog guard drops the two tests that compared or read the parent's block. The null-normalization Go tests used talos keys of the real Kubernetes schema as their fixtures; they use oidc.mode, the same required-with-default shape under an optional root section, and addons.cilium.valuesOverride for the free-form case. Assisted-by: LLM Signed-off-by: Myasnikov Daniil <[email protected]>
1 parent 76a34d3 commit 90f0b04

17 files changed

Lines changed: 76 additions & 249 deletions

‎api/apps/v1alpha1/kubernetes/types.go‎

Lines changed: 0 additions & 21 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎api/apps/v1alpha1/kubernetes/zz_generated.deepcopy.go‎

Lines changed: 0 additions & 17 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎docs/release/changelogs.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ git diff --name-only $PREV..$NEW -- 'packages/*/charts/*/Chart.yaml' 'packages/*
6060
done
6161

6262
# B. Out-of-Chart.yaml pins (Talos, tenant K8s, vendored images)
63-
for path in packages/core/talos/images/talos/profiles/installer.yaml packages/core/installer/values.yaml packages/apps/kubernetes/values.yaml; do
63+
for path in packages/core/talos/images/talos/profiles/installer.yaml packages/core/installer/values.yaml packages/apps/kubernetes/values.yaml packages/apps/kubernetes-nodes/values.yaml; do
6464
git diff $PREV..$NEW -- "$path" | head -40
6565
done
6666
git diff --name-only $PREV..$NEW -- 'images/*/Dockerfile'

‎hack/check-worker-image-catalog-defaults.bats‎

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -148,30 +148,3 @@ NODES_SCHEMA="$REPO_ROOT/packages/apps/kubernetes-nodes/values.schema.json"
148148
esac
149149
done
150150
}
151-
152-
# -----------------------------------------------------------------------------
153-
# Third guard, and the premise the first one rests on. The catalog is keyed off
154-
# the kubernetes-nodes chart's `talos` defaults, but the parent kubernetes chart
155-
# carries its own copy of the same block since the Phase 2 split, and its own
156-
# values.yaml says to keep the two in sync. Nothing enforced that: the pool
157-
# chart's `make update` copies files/versions.yaml and images/kubectl.tag from
158-
# the parent and not the talos block, so a one-sided bump leaves the parent's
159-
# support-matrix guard reasoning about one Talos release while every worker boots
160-
# another — and the catalog check above would go on passing, because it only ever
161-
# reads one of the two files.
162-
163-
PARENT_VALUES="$REPO_ROOT/packages/apps/kubernetes/values.yaml"
164-
165-
@test "the parent kubernetes chart and kubernetes-nodes agree on their Talos defaults" {
166-
for key in version schematicID imageFactoryURL installerRepository registryMirrors; do
167-
parent=$(yq ".talos.${key}" "$PARENT_VALUES")
168-
pool=$(yq ".talos.${key}" "$APP_VALUES")
169-
if [ "$parent" != "$pool" ]; then
170-
echo "talos.${key} differs between the two charts:" >&2
171-
echo " packages/apps/kubernetes/values.yaml: $parent" >&2
172-
echo " packages/apps/kubernetes-nodes/values.yaml: $pool" >&2
173-
echo "both are declared 'keep in sync' and a worker pool follows the second while the parent's support-matrix guard reads the first" >&2
174-
return 1
175-
fi
176-
done
177-
}

‎hack/e2e-chainsaw/_lib/run-kubernetes.sh‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ cozy_e2e_storage_class() {
1818
esac
1919
}
2020

21-
# talos_spec_block: emit the tenant Kubernetes CR `spec.talos` block with the Talos
21+
# talos_spec_block: emit the tenant KubernetesNodes CR `spec.talos` block with the Talos
2222
# OS image cache (imageFactoryURL) when the in-sandbox cache is up. Prints nothing
2323
# when it falls back to the public default, so the chart default applies.
2424
# Indented for insertion directly under `spec:` in the heredoc below.
@@ -5702,8 +5702,9 @@ YAML
57025702

57035703
# Point worker DataVolume imports at the in-sandbox Talos OS image cache when it
57045704
# is up, falling back to the public factory otherwise. Worker image pulls use
5705-
# the chart's public-registry default. Emitted right under spec: as
5706-
# `talos: { imageFactoryURL: ... }`, or nothing when the default applies.
5705+
# the chart's public-registry default. Emitted right under spec: of the
5706+
# KubernetesNodes pool below as `talos: { imageFactoryURL: ... }`, or nothing
5707+
# when the default applies. The Kubernetes CR takes no worker image field.
57075708
local talos_block
57085709
talos_block=$(talos_spec_block)
57095710

@@ -5714,7 +5715,6 @@ metadata:
57145715
name: "${test_name}"
57155716
namespace: tenant-test
57165717
spec:
5717-
${talos_block}
57185718
${oidc_block}
57195719
addons:
57205720
certManager:

‎hack/e2e-install-cozystack.bats‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,10 +49,10 @@
4949
# Best-effort: never fail the suite on the band-aid. Remove once tenant workers
5050
# no longer bulk-pull the OS image from the public internet in CI.
5151
local sid ver
52-
sid=$(yq '.talos.schematicID' packages/apps/kubernetes/values.yaml 2>/dev/null)
53-
ver=$(yq '.talos.version' packages/apps/kubernetes/values.yaml 2>/dev/null)
52+
sid=$(yq '.talos.schematicID' packages/apps/kubernetes-nodes/values.yaml 2>/dev/null)
53+
ver=$(yq '.talos.version' packages/apps/kubernetes-nodes/values.yaml 2>/dev/null)
5454
if [ -z "$sid" ] || [ "$sid" = "null" ] || [ -z "$ver" ] || [ "$ver" = "null" ]; then
55-
echo "WARNING: could not read talos.schematicID/version from values.yaml — skipping mirror (fallback to public factory)"
55+
echo "WARNING: could not read talos.schematicID/version from packages/apps/kubernetes-nodes/values.yaml — skipping mirror (fallback to public factory)"
5656
return 0
5757
fi
5858
# The CiliumClusterwideNetworkPolicy in the manifest is intentionally NOT applied

‎hack/e2e-talos-image-cache.yaml‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
# This Deployment fetches the image ONCE at e2e-install time with an aggressive
1515
# curl retry loop (decoupling the one flaky external fetch from the many
1616
# per-worker imports), then serves it locally over plain HTTP with range support.
17-
# Tenant `Kubernetes` CRs point `spec.talos.imageFactoryURL` at this Service
17+
# Tenant `KubernetesNodes` CRs point `spec.talos.imageFactoryURL` at this Service
1818
# (see hack/e2e-chainsaw/_lib/run-kubernetes.sh) so every worker imports from the
1919
# warm local copy instead of the public internet. Tenant namespaces run under a
2020
# default-deny Cilium egress installed by the tenant chart, whose allow rules cover
@@ -28,7 +28,7 @@
2828
# mirror can only help, never make CI worse.
2929
#
3030
# The __SCHEMATIC_ID__ / __TALOS_VERSION__ placeholders are substituted at apply
31-
# time by hack/e2e-install-cozystack.bats from packages/apps/kubernetes/values.yaml.
31+
# time by hack/e2e-install-cozystack.bats from packages/apps/kubernetes-nodes/values.yaml.
3232
#
3333
# CI band-aid, not a product artifact. The durable fix is the overridable
3434
# `talos.imageFactoryURL` chart value this manifest exercises; a self-hosted

‎hack/run-kubernetes-talos-spec_test.bats‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# -----------------------------------------------------------------------------
33
# Unit tests for talos_spec_block in hack/e2e-chainsaw/_lib/run-kubernetes.sh
44
#
5-
# It is the composition point for the tenant Kubernetes CR's `spec.talos`: the
5+
# It is the composition point for the tenant KubernetesNodes CR's `spec.talos`: the
66
# Talos OS image cache contributes imageFactoryURL when available. The result is
77
# spliced into an unquoted heredoc directly under `spec:`, so an indentation slip
88
# does not fail this function -- it produces a CR the API rejects, and every
@@ -32,7 +32,7 @@ load test_helper
3232
# Splice a talos_spec_block result under `spec:` of a minimal CR and print the
3333
# document, so yq can be asked what the tenant apiserver would see.
3434
spec_doc() {
35-
printf 'apiVersion: apps.cozystack.io/v1alpha1\nkind: Kubernetes\nmetadata:\n name: t\nspec:\n%s\n host: ""\n' "$1"
35+
printf 'apiVersion: apps.cozystack.io/v1alpha1\nkind: KubernetesNodes\nmetadata:\n name: t\nspec:\n%s\n cluster: t\n' "$1"
3636
}
3737

3838
@test "no Talos image cache renders nothing, so the chart default applies" {
@@ -59,6 +59,6 @@ spec_doc() {
5959
# talos_spec_block writes imageFactoryURL by hand. If the chart ever renames
6060
# it, the CR would be rejected only at e2e time, and this file is the cheapest
6161
# place to notice.
62-
yq -e '.talos | has("imageFactoryURL")' packages/apps/kubernetes/values.yaml >/dev/null \
63-
|| { echo "packages/apps/kubernetes/values.yaml has no talos.imageFactoryURL; talos_spec_block would emit a key the chart rejects" >&2; exit 1; }
62+
yq -e '.talos | has("imageFactoryURL")' packages/apps/kubernetes-nodes/values.yaml >/dev/null \
63+
|| { echo "packages/apps/kubernetes-nodes/values.yaml has no talos.imageFactoryURL; talos_spec_block would emit a key the pool chart ignores" >&2; exit 1; }
6464
}

0 commit comments

Comments
 (0)