mirror of
https://github.com/cozystack/cozystack.git
synced 2026-11-21 12:13:55 +09:00
chore(kubernetes-nodes): drop split-era history from template and test comments
Comments in the pool chart still explain it against the monolithic kubernetes chart, a "Phase 2b" migration, a render-parity gate and a tests/render-parity.sh that no longer exist, an Ubuntu+kubeadm worker, and a maxUnhealthy default of "0" that is "50%". The Makefile's update target claimed to copy the Talos support matrix, which is a literal in _helpers.tpl; it copies the Kubernetes version map. A reader of these comments takes them as the description of what the code relies on, so they now describe the code as it is. Only Helm comments are touched: the YAML comments inside the hashed machine config and machine template text stay as they are, since editing them would rename the TalosConfigTemplate or KubevirtMachineTemplate and roll every worker. Assisted-by: LLM Signed-off-by: Myasnikov Daniil <myasnikovdaniil2001@gmail.com>
This commit is contained in:
11 files changed
+44
-61
No files matched your search
@@ -9,16 +9,15 @@ generate:
|
||||
cozyvalues-gen -m 'kubernetesnodes' -v values.yaml -s values.schema.json -r README.md -g ../../../api/apps/v1alpha1/kubernetesnodes/types.go
|
||||
../../../hack/update-crd.sh
|
||||
|
||||
# Keep the worker-image inputs (Talos<->Kubernetes support matrix and the
|
||||
# kubectl.tag used by the talos-reconcile Job) in lockstep with the parent
|
||||
# kubernetes chart. They are copied, not symlinked, so `helm package` bundles
|
||||
# them; run this after the parent chart's `make update`.
|
||||
# Copy the Kubernetes version map (files/versions.yaml, minor -> patch release)
|
||||
# and the kubectl.tag used by the talos-reconcile Job from the kubernetes
|
||||
# chart, which owns both. They are copied, not symlinked, so `helm package`
|
||||
# bundles them; run this after either changes there.
|
||||
#
|
||||
# _talosconfigtemplate.tpl is not copied from anywhere: the parent chart no
|
||||
# longer carries worker node pools, so this chart owns the worker machine
|
||||
# config outright. It stays here because the TalosConfigTemplate it renders is
|
||||
# content-hash named and both consumers in this chart - nodegroup.yaml, which
|
||||
# writes bootstrap.configRef, and talos-reconcile-job.yaml, which creates the
|
||||
# _talosconfigtemplate.tpl is not copied from anywhere: this chart owns the
|
||||
# worker machine config. The TalosConfigTemplate it renders is content-hash
|
||||
# named and both consumers in this chart - nodegroup.yaml, which writes
|
||||
# bootstrap.configRef, and talos-reconcile-job.yaml, which creates the
|
||||
# object - have to hash the same bytes.
|
||||
update:
|
||||
cp ../kubernetes/files/versions.yaml files/versions.yaml
|
||||
|
||||
@@ -165,10 +165,9 @@ The pool attaches to the parent Kubernetes CR named .Values.cluster, whose
|
||||
HelmRelease (and therefore CAPI Cluster / KamajiControlPlane / KubevirtCluster
|
||||
and every worker object it owns) is `kubernetes-<cluster>`. This chart does
|
||||
NOT use its own .Release.Name for CAPI wiring — the pool lives in a separate
|
||||
HelmRelease from the control plane, so every reference that the monolithic
|
||||
chart made through $.Release.Name is reconstructed here as kubernetes-<cluster>
|
||||
instead. Linkage is by name convention (mirrors vm-instance -> vm-disk), not
|
||||
ownerReference or lookup-gated render.
|
||||
HelmRelease from the control plane, so every reference to the cluster's objects
|
||||
is built from kubernetes-<cluster>. Linkage is by name convention (mirrors
|
||||
vm-instance -> vm-disk), not ownerReference or lookup-gated render.
|
||||
*/}}
|
||||
{{- define "kubernetes-nodes.clusterName" -}}
|
||||
{{- if not .Values.cluster -}}
|
||||
@@ -194,9 +193,9 @@ The node-group name for this pool, derived from the release name.
|
||||
A KubernetesNodes CR is named <cluster>-<pool> and gets the release prefix
|
||||
`kubernetes-nodes-`, so the release name is `kubernetes-nodes-<cluster>-<pool>`.
|
||||
The group name is the <pool> suffix. Enforcing the `<cluster>-` segment keeps
|
||||
every rendered object named `kubernetes-<cluster>-<pool>` — byte-identical to
|
||||
what the monolithic chart rendered for the same group — and prevents two
|
||||
clusters in one namespace from colliding on a pool named e.g. `md0`.
|
||||
every rendered object named `kubernetes-<cluster>-<pool>` — the names worker
|
||||
objects adopted by migration 56 already carry — and prevents two clusters in
|
||||
one namespace from colliding on a pool named e.g. `md0`.
|
||||
*/}}
|
||||
{{- define "kubernetes-nodes.groupName" -}}
|
||||
{{- $prefix := printf "kubernetes-nodes-%s-" .Values.cluster -}}
|
||||
@@ -253,8 +252,7 @@ control plane is supported (up to n-3 upstream) and is the normal state during a
|
||||
rolling upgrade — the parent Kubernetes CR is bumped first, then each pool. A
|
||||
symmetric equality check would flip every pool of a cluster to render-failure the
|
||||
moment the parent is bumped, blocking all pool operations until each pool is
|
||||
hand-edited, so the check is directional. The split removed the single `version`
|
||||
that used to feed both control plane and workers. Looks up the parent
|
||||
hand-edited, so the check is directional. Looks up the parent
|
||||
KamajiControlPlane (named like the reconstructed clusterName) and compares its
|
||||
spec.version minor against .Values.version. Skipped when the lookup is empty
|
||||
(helm template / unittest, or the parent not yet present) so it validates only
|
||||
|
||||
@@ -69,7 +69,7 @@
|
||||
{{- /* Management cluster DNS domain. Tenant Kubernetes workers run as
|
||||
KubeVirt VMs inside the management cluster's pod network and need
|
||||
to resolve management-cluster service short names ("<svc>.<ns>.svc")
|
||||
the same way an Ubuntu+kubeadm worker did via cloud-init DHCP. The
|
||||
the same way a pod of the management cluster does. The
|
||||
kubevirt-csi NFS mount path is the load-bearing case: kubelet on
|
||||
the worker host calls `mount.nfs linstor-csi-nfs.cozy-linstor.svc`
|
||||
(no domain suffix), and without searchDomains in /etc/resolv.conf
|
||||
|
||||
@@ -1,17 +1,16 @@
|
||||
{{- /*
|
||||
Worker node pool for a managed Kubernetes cluster.
|
||||
|
||||
This chart is the second half of the Kubernetes-app split (cozystack/community#8):
|
||||
the control plane (Cluster / KamajiControlPlane / KubevirtCluster / PKI) lives in
|
||||
the `kubernetes` chart, and each worker pool is a separate `kubernetes-nodes`
|
||||
release. The pool objects (KubevirtMachineTemplate, MachineDeployment,
|
||||
MachineHealthCheck, worker WorkloadMonitor) and the talos-reconcile Job that
|
||||
produces the pool's TalosConfigTemplate are rendered here, wired to the parent
|
||||
cluster `kubernetes-<cluster>` by name convention (see _helpers.tpl). Every
|
||||
reference the monolithic chart made through $.Release.Name is reconstructed here
|
||||
as the parent clusterName so the objects are byte-identical to what the parent
|
||||
rendered for the same group — the KubevirtMachineTemplate is content-hash-named,
|
||||
so any drift would roll every live worker VM.
|
||||
The control plane (Cluster / KamajiControlPlane / KubevirtCluster / PKI) lives
|
||||
in the `kubernetes` chart, and each worker pool is a separate
|
||||
`kubernetes-nodes` release. The pool objects (machine template,
|
||||
MachineDeployment, MachineHealthCheck, worker WorkloadMonitor) and the
|
||||
talos-reconcile Job that produces the pool's TalosConfigTemplate are rendered
|
||||
here, wired to the parent cluster `kubernetes-<cluster>` by name convention
|
||||
(see _helpers.tpl). Every reference to the cluster is built from that
|
||||
clusterName. Pools adopted by migration 56 keep running on objects of exactly
|
||||
these names and this content: the machine template is content-hash-named, so
|
||||
any drift in its text would roll every live worker VM.
|
||||
|
||||
Talos -> Kubernetes support matrix, against the pool default. The pool can also
|
||||
reach a different Talos release through osImage.builtin.version /
|
||||
@@ -1066,8 +1065,7 @@ spec:
|
||||
{{- /* MHC spec.maxUnhealthy is an IntOrString. CAPI admission accepts a
|
||||
bare integer (0, 1, ...) or a percentage string ("0%", "50%"), but
|
||||
rejects a quoted plain integer ("0"). Quote only when the operator
|
||||
supplied a percentage; otherwise render the value as a bare int so
|
||||
the admission webhook is happy with the chart-default "0". */}}
|
||||
supplied a percentage; otherwise render the value as a bare int. */}}
|
||||
{{- $maxUnhealthy := toString $.Values.maxUnhealthy }}
|
||||
{{- $muSource := "maxUnhealthy" }}
|
||||
{{- if hasSuffix "%" $maxUnhealthy }}
|
||||
|
||||
@@ -1,10 +1,9 @@
|
||||
suite: kubelet reservation validation
|
||||
|
||||
# The kubelet-reservation branch (quantity-format regexes, positive-value and
|
||||
# eviction-threshold invariants) moved verbatim from the parent chart into
|
||||
# nodegroup.yaml. These failure-path guards reject malformed input at render
|
||||
# time before a broken machineconfig reaches a worker. Ported from the parent
|
||||
# chart's kubelet_reservation_test.
|
||||
# The kubelet-reservation branch of nodegroup.yaml (quantity-format regexes,
|
||||
# positive-value and eviction-threshold invariants). These failure-path guards
|
||||
# reject malformed input at render time before a broken machineconfig reaches
|
||||
# a worker.
|
||||
|
||||
templates:
|
||||
- templates/nodegroup.yaml
|
||||
|
||||
@@ -4,8 +4,6 @@ suite: MachineHealthCheck maxUnhealthy int-vs-percent rendering
|
||||
# but rejects a bare numeric STRING ("0"): a percentage must be a quoted string
|
||||
# and a count must be an unquoted int. nodegroup.yaml renders it as
|
||||
# maxUnhealthy: {{ if hasSuffix "%" ... }}{{ . | quote }}{{ else }}{{ . | int }}{{ end }}
|
||||
# Ported from the parent chart's mhc_rendering_test after the pool moved to
|
||||
# kubernetes-nodes.
|
||||
|
||||
templates:
|
||||
- templates/nodegroup.yaml
|
||||
|
||||
@@ -16,9 +16,8 @@ suite: MachineHealthCheck timeouts
|
||||
#
|
||||
# `nodeStartupTimeout` bounds the phase before any of that: it is the window a
|
||||
# Machine has to produce a Node at all, and the unhealthyConditions entries are
|
||||
# evaluated only once one exists. Its default is pinned here because the parity
|
||||
# gate compares this chart against its counterpart, so a default moved in both
|
||||
# at once passes there and only fails on this assertion.
|
||||
# evaluated only once one exists. Its default is pinned here because a moved
|
||||
# default changes every pool that does not set the field.
|
||||
|
||||
templates:
|
||||
- templates/nodegroup.yaml
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
suite: worker pool pod CPU limit
|
||||
|
||||
# Mirror of the parent kubernetes chart's suite, on the pool-shaped values of
|
||||
# this chart. `podCpuLimit` is the only knob that sets
|
||||
# `podCpuLimit` is the only knob that sets
|
||||
# `domain.resources.limits.cpu` on a worker VM. KubeVirt otherwise derives that
|
||||
# limit from the guest vCPU count whenever the namespace carries a ResourceQuota
|
||||
# that limits CPU, and it stops deriving as soon as the VMI declares the limit
|
||||
@@ -79,8 +78,7 @@ tests:
|
||||
asserts:
|
||||
# Absent, not empty: the KubevirtMachineTemplate is content-hash named, so
|
||||
# a `cpu:` key rendered for a pool that asked for nothing would rename the
|
||||
# template and roll every live worker VM of the pool on upgrade. The
|
||||
# render-parity gate compares those bytes against the parent chart.
|
||||
# template and roll every live worker VM of the pool on upgrade.
|
||||
- notExists:
|
||||
path: spec.template.spec.virtualMachineTemplate.spec.template.spec.domain.resources.limits.cpu
|
||||
- equal:
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
suite: worker pool pod CPU request
|
||||
|
||||
# Mirror of the parent kubernetes chart's suite, on the pool-shaped values of
|
||||
# this chart. `podCpuRequest` is the only knob that sets
|
||||
# `podCpuRequest` is the only knob that sets
|
||||
# `domain.resources.requests.cpu` on a worker VM, and it is the other half of
|
||||
# `podCpuLimit`: KubeVirt copies a declared CPU limit into the request when the
|
||||
# VM declares none, so without this field the ceiling and the scheduler
|
||||
@@ -100,8 +99,7 @@ tests:
|
||||
asserts:
|
||||
# Absent, not empty: the KubevirtMachineTemplate is content-hash named, so
|
||||
# a `cpu:` key rendered for a pool that asked for nothing would rename the
|
||||
# template and roll every live worker VM of the pool on upgrade. The
|
||||
# render-parity gate compares those bytes against the parent chart.
|
||||
# template and roll every live worker VM of the pool on upgrade.
|
||||
- notExists:
|
||||
path: spec.template.spec.virtualMachineTemplate.spec.template.spec.domain.resources.requests.cpu
|
||||
- equal:
|
||||
|
||||
@@ -2,12 +2,9 @@ suite: worker node pool golden render snapshot
|
||||
|
||||
# Freezes the full rendered pool (KubevirtMachineTemplate, MachineDeployment,
|
||||
# MachineHealthCheck, worker WorkloadMonitor) for a representative node group.
|
||||
# In PR-2a this render was proven byte-identical to the monolithic kubernetes
|
||||
# chart's output via tests/render-parity.sh; PR-2b removed the pool from the
|
||||
# parent, so cross-chart parity can no longer run. This snapshot takes over as
|
||||
# the drift guard: any change to the rendered pool objects (which would rename
|
||||
# the content-hashed KubevirtMachineTemplate and churn live worker VMs on
|
||||
# upgrade) fails here until the snapshot is regenerated deliberately with
|
||||
# It is the drift guard for those objects: any change to them (which would
|
||||
# rename the content-hashed KubevirtMachineTemplate and churn live worker VMs
|
||||
# on upgrade) fails here until the snapshot is regenerated deliberately with
|
||||
# `helm unittest -u`.
|
||||
#
|
||||
# Coverage note: every case sets instanceType: "" with explicit resources,
|
||||
@@ -44,10 +41,10 @@ tests:
|
||||
asserts:
|
||||
- matchSnapshot: {}
|
||||
|
||||
# GPU and kubelet-override branches live on in nodegroup.yaml after the split
|
||||
# and are content-hash inputs to the KubevirtMachineTemplate; pin them too so
|
||||
# a change to either branch that would rename the KMT (and roll live GPU or
|
||||
# kubelet-tuned worker VMs) fails here. Value sets mirror the PR-2a parity gate.
|
||||
# The GPU and kubelet-override branches of nodegroup.yaml are content-hash
|
||||
# inputs to the KubevirtMachineTemplate; pin them too so a change to either
|
||||
# branch that would rename the KMT (and roll live GPU or kubelet-tuned worker
|
||||
# VMs) fails here.
|
||||
- it: matches the golden render of a GPU pool
|
||||
set:
|
||||
roles: []
|
||||
|
||||
@@ -7,7 +7,6 @@ suite: Talos worker machineconfig (GPU labels + kubelet reservations)
|
||||
# - GPU pools must inject nodeLabels gpu=on so HAMi's device plugin
|
||||
# (nodeSelector gpu=on) schedules and advertises nvidia.com/gpu;
|
||||
# - kubelet reservation overrides must reach the machineconfig kubelet config.
|
||||
# Ported from the parent chart's gpu_node_labels_test / kubelet_reservation_test.
|
||||
|
||||
templates:
|
||||
- templates/talos-reconcile-job.yaml
|
||||
|
||||
Reference in new issue
Block a user