You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit a74f1bf
Browse filesBrowse the repository at this point in the historyBrowse files
fix(engine): keep replace-merged fields whole in node files
Before a node file is laid over the rendered config, the engine prunes
from its body what the render already carries. Where Talos replaces
instead of merging, that prune is wrong: the body is cut down to the
operator's delta and the replace writes only the delta. The engine knew
the `merge:"replace"` fields of v1alpha1 and NetworkRuleConfig only.
From Talos v1.14 the charts write KubeNetworkConfig, and on cozystack
with OIDC KubeAuthenticationConfig, into every node file. Adding a pod
subnet there dropped the rendered one; adding an OIDC audience dropped
the anonymous health-check access. A body BGPInstanceConfig or
CRIBaseRuntimeSpecConfig over a rendered one lost entries the same way.
Typed documents now root their prune paths at their kind, since one
field name is replace-tagged on one kind and merged on another
(KubeAdmissionControlConfig's configuration merges), and the table
carries every replace-tagged field of the typed documents.
Component extraArgs, in v1alpha1 and in the typed documents, merge key
by key and replace the whole value of each key. A list-valued flag such
as feature-gates extended in the node file lost its rendered entries;
the prune now drops only keys the body restates exactly.
Assisted-by: LLM
Signed-off-by: Aleksei Sviridkin <[email protected]>
Copy file name to clipboardExpand all lines: docs/configuration/node-files.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -73,7 +73,7 @@ A node file can carry Talos config below its modeline (for example, a custom `ho
73
73
74
74
## Idempotent applies
75
75
76
-
Repeated `talm apply` runs against an already-configured node do not duplicate entries. Before the strategic merge runs, the engine prunes from the body every primitive-list entry the rendered template already carries (e.g. certSANs, nameservers, validSubnets). For object arrays the upstream patcher merges by identity (machine.network.interfaces by `interface:` or `deviceSelector:`, vlans by `vlanId:`, apiServer admissionControl by `name:`), the prune descends into matched pairs and dedupes the inner primitive lists too — so re-applying after `talm template -I` does not double interface addresses, vlan addresses, or admission-control exemption namespaces. For object arrays without an upstream identity merge (extraVolumes, kernel.modules, wireguard.peers, ...), body items that deep-equal a rendered counterpart are dropped, covering the dominant full-restate case. Fields tagged `merge:"replace"` upstream are passed through verbatim — pruning them would let the upstream replace silently drop the rendered entries on a partial edit. This covers v1alpha1 root paths `cluster.network.podSubnets`, `cluster.network.serviceSubnets`, `cluster.apiServer.auditPolicy`, and the typed `NetworkRuleConfig` paths `ingress` and `portSelector.ports`.
76
+
Repeated `talm apply` runs against an already-configured node do not duplicate entries. Before the strategic merge runs, the engine prunes from the body every primitive-list entry the rendered template already carries (e.g. certSANs, nameservers, validSubnets). For object arrays the upstream patcher merges by identity (machine.network.interfaces by `interface:` or `deviceSelector:`, vlans by `vlanId:`, apiServer admissionControl by `name:`), the prune descends into matched pairs and dedupes the inner primitive lists too — so re-applying after `talm template -I` does not double interface addresses, vlan addresses, or admission-control exemption namespaces. For object arrays without an upstream identity merge (extraVolumes, kernel.modules, wireguard.peers, ...), body items that deep-equal a rendered counterpart are dropped, covering the dominant full-restate case. Fields tagged `merge:"replace"` upstream are passed through verbatim — pruning them would let the upstream replace silently drop the rendered entries on a partial edit. This covers v1alpha1 root paths `cluster.network.podSubnets`, `cluster.network.serviceSubnets`, `cluster.apiServer.auditPolicy`, the typed `NetworkRuleConfig` paths `ingress` and `portSelector.ports`, `advertise`, `importRoutes` and `neighbors` of `BGPInstanceConfig`, `overrides` of `CRIBaseRuntimeSpecConfig`, and from Talos v1.14 `podSubnets` and `serviceSubnets` of `KubeNetworkConfig`, `pod` of `KubeStaticPodConfig` and `configuration` of `KubeAuthenticationConfig`, `KubeAuditPolicyConfig` and `KubeCredentialProviderConfig`. The typed paths are matched per kind: `configuration` of `KubeAdmissionControlConfig` merges and is pruned as usual. Component `extraArgs` (kubelet, apiserver, controller-manager, scheduler, proxy, etcd, in v1alpha1 and in the typed documents) merge key by key and replace the whole value of each key the body sets, so the prune drops only keys the body restates exactly; a list-valued flag such as `feature-gates` edited in the node file keeps the rendered entries the body lists.
Copy file name to clipboardExpand all lines: docs/manual-test-plan.md
+3-1Lines changed: 3 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -749,7 +749,9 @@ Node files from an earlier contract, on a node running Talos v1.14: in a project
749
749
750
750
On a node running Talos v1.14 (any preset): `talm apply --dry-run -f nodes/<node>.yaml`, then apply. Expected: the drift preview lists `Kube*` documents rather than `cluster.*` fields, the node accepts the config, and `talm get kubeletconfig` / `talm get staticpods` show the kubelet and control-plane args from values. On cozystack, `kubectl get ds --namespace kube-system` lists neither `kube-flannel` nor `kube-proxy`, and control-plane nodes carry no `node-role.kubernetes.io/control-plane:NoSchedule` taint.
751
751
752
-
Regression anchor: `TestContract_ShippedChartsRenderValidConfig` loads both presets through the engine on v1.12, v1.13 and v1.14, at defaults and with every Kubernetes knob set, and validates the full render and the applied node file in machinery; `TestContract_ApiServerAuthFlagsRefusedFromV114` pins the refused flags; `TestApplyTemplatesPerNode_RefusesNodeFileWithSupersededFields` pins the apply-time check on an old node file; `TestContract_ChartKubeDocumentMergesIntoBundle`, `TestContract_ChartDeleteSelectorRemovesBundleDocument` and `TestContract_NonFullRenderKeepsChartKubeDocumentsVerbatim` pin the merge.
752
+
Partial edits of replace-tagged typed fields, on a node running Talos v1.14. A list-valued flag needs a rendered list to edit, and `extraApiServerArgs` takes scalars only, so first, on generic, set `extraApiServerArgs: { max-requests-inflight: "400" }` in `values.yaml`, add ` feature-gates: [A=true]` on the line after the `extraApiServerArgs` include under `kind: KubeAPIServerConfig` in the project's `templates/_helpers.tpl`, and re-render the node file with `talm template -I`. Then, in a v1.14 node file, add a second entry to `podSubnets` of the `KubeNetworkConfig` document (keep the rendered one); on cozystack with `oidcIssuerUrl` set, add a second audience to the `KubeAuthenticationConfig` jwt entry; and in the generic node file change the flag to `feature-gates: [A=true, B=true]`. Run `talm apply --dry-run -f nodes/<node>.yaml`. Expected: the config sent keeps the rendered pod subnet next to the added one, and `KubeAuthenticationConfig` still carries the `anonymous` block with `/livez`, `/readyz` and `/healthz` next to both audiences, and the flag keeps both entries.
753
+
754
+
Regression anchor: `TestContract_ShippedChartsRenderValidConfig` loads both presets through the engine on v1.12, v1.13 and v1.14, at defaults and with every Kubernetes knob set, and validates the full render and the applied node file in machinery; `TestContract_ApiServerAuthFlagsRefusedFromV114` pins the refused flags; `TestApplyTemplatesPerNode_RefusesNodeFileWithSupersededFields` pins the apply-time check on an old node file; `TestContract_ChartKubeDocumentMergesIntoBundle`, `TestContract_ChartDeleteSelectorRemovesBundleDocument` and `TestContract_NonFullRenderKeepsChartKubeDocumentsVerbatim` pin the merge; the `KubeNetworkConfig` and `KubeAuthenticationConfig` cases of `TestMergeFileAsPatch`, `TestPruneIdenticalKeys_ReplacePathsAreKeyedByKind` and `TestPruneIdenticalKeys_KeepsReplaceTaggedNetworkAndCRIFields` (the same rule for `BGPInstanceConfig` and `CRIBaseRuntimeSpecConfig` body documents) pin the partial edits.
0 commit comments