Repository navigation
Commit 2002266
committed
fix(kubernetes): name TalosConfigTemplate by content hash
TalosConfigTemplate.spec is immutable — vtalosconfigtemplate.cluster.x-k8s.io
denies any mutation with "TalosConfigTemplate.Spec is immutable" — but the
talos-reconcile Job applied it under a fixed <release>-<group> name on every
reconcile. Once the template existed, no change to the rendered worker machine
config could reach the cluster: the apply was rejected server-side while the
HelmRelease stayed Ready. Observed with machine.network.searchDomains after a
clusterDomain correction; the same held for certSANs, machine.registries and
nameservers.
Name the template after a 6-char hash of its rendered spec, the idiom
KubevirtMachineTemplate already uses in the same chart, and point
MachineDeployment.spec.template.spec.bootstrap.configRef at that name. A content
change now creates a new template instead of attempting a rejected mutation, and
CAPI rolls the workers onto it.
The spec is rendered from one named template shared by the Job (which embeds it
in its heredoc) and the MachineDeployment (which hashes it into configRef), so
the two cannot compute different names. The runtime values the Job substitutes
(CA certificates, Service ClusterIP, tokens) stay shell placeholders and are not
hashed, so a certificate rotation does not roll workers.
The talos-reconcile Role pins its TalosConfigTemplate get, patch, update
and delete rights to the pool's own template, so it names the hashed
template too. A server-side apply of a template that does not exist yet
is still a PATCH on that name: a rule left on <release>-<group> would
leave the Job Forbidden and the pool with no template to scale onto. The
replace-on-immutable path is kept and pointed at the same name, because
the runtime values sit outside the hash: a new apiserver address still
renders a different spec under an unchanged name.
Upgrade note: existing clusters roll their Talos workers once, because the
configRef moves from <release>-<group> to the hashed name and CAPI creates a new
MachineSet for it. The rendered machine config itself is unchanged by this
commit. The pre-existing fixed-name template is left in place — the outgoing
MachineSet still references it — and is garbage-collected with the
KamajiControlPlane when the cluster is deleted.
A pool sized by instanceType rather than by explicit resources has a
second roll trigger. Its kubelet reservations are resolved through a live
lookup of the VirtualMachineClusterInstancetype, so that object's size is
part of the hashed spec even though the chart does not own it: a
platform-side change to the instancetype rotates the name and rolls the
pool again. That is the mechanism working as intended - the reservations
really did change - but it is a roll the operator did not initiate, and
the KubevirtMachineTemplate hash this mirrors does not have the property,
since it embeds the instancetype by name and never its resolved size.
Fixes #3515
Signed-off-by: Mattia Eleuteri <[email protected]>
Assisted-by: LLM1 parent b86fd7a commit 2002266
8 files changed
Lines changed: 456 additions & 286 deletions
File tree
- packages/apps/kubernetes-nodes
- templates
- tests
- __snapshot__
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
13 | | - | |
14 | | - | |
15 | | - | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
16 | 23 | | |
17 | 24 | | |
18 | 25 | | |
| 26 | + | |
19 | 27 | | |
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
106 | 106 | | |
107 | 107 | | |
108 | 108 | | |
| 109 | + | |
109 | 110 | | |
110 | 111 | | |
111 | 112 | | |
| |||
863 | 864 | | |
864 | 865 | | |
865 | 866 | | |
866 | | - | |
| 867 | + | |
| 868 | + | |
| 869 | + | |
| 870 | + | |
| 871 | + | |
| 872 | + | |
| 873 | + | |
867 | 874 | | |
868 | 875 | | |
869 | 876 | | |
| |||
959 | 966 | | |
960 | 967 | | |
961 | 968 | | |
962 | | - | |
| 969 | + | |
963 | 970 | | |
964 | 971 | | |
965 | 972 | | |
| |||
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
109 | 109 | | |
110 | 110 | | |
111 | 111 | | |
112 | | - | |
| 112 | + | |
113 | 113 | | |
114 | 114 | | |
115 | 115 | | |
| |||
262 | 262 | | |
263 | 263 | | |
264 | 264 | | |
265 | | - | |
| 265 | + | |
266 | 266 | | |
267 | 267 | | |
268 | 268 | | |
| |||
418 | 418 | | |
419 | 419 | | |
420 | 420 | | |
421 | | - | |
| 421 | + | |
422 | 422 | | |
423 | 423 | | |
424 | 424 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
61 | 61 | | |
62 | 62 | | |
63 | 63 | | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
64 | 68 | | |
65 | 69 | | |
66 | 70 | | |
67 | 71 | | |
68 | 72 | | |
69 | 73 | | |
70 | 74 | | |
71 | | - | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
72 | 79 | | |
73 | 80 | | |
74 | 81 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
26 | 26 | | |
27 | 27 | | |
28 | 28 | | |
29 | | - | |
30 | | - | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
31 | 33 | | |
32 | 34 | | |
33 | | - | |
| 35 | + | |
34 | 36 | | |
35 | 37 | | |
36 | 38 | | |
| |||
51 | 53 | | |
52 | 54 | | |
53 | 55 | | |
54 | | - | |
55 | | - | |
56 | | - | |
57 | | - | |
58 | | - | |
59 | | - | |
60 | | - | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
61 | 65 | | |
62 | 66 | | |
63 | 67 | | |
| |||
82 | 86 | | |
83 | 87 | | |
84 | 88 | | |
85 | | - | |
86 | | - | |
87 | | - | |
88 | | - | |
89 | | - | |
90 | | - | |
91 | | - | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
92 | 98 | | |
93 | 99 | | |
94 | 100 | | |
| |||
0 commit comments