Files
cozystack/packages/system
Ivan Okhotnikov 0c4525afe2 fix(vertical-pod-autoscaler): drop tls-migrator hook — it was a no-op
Kvaps' review on #3178 correctly identified that the pre-upgrade
tls-migrator Job cannot do what its comments claim, for two
independent reasons:

  1. Helm decides what to delete on upgrade from the STORED release
     manifest, not from live labels on the object. The only live-
     object opt-out is the \`helm.sh/resource-policy: keep\`
     annotation — see the \`original.Difference(target)\` loop in
     helm's pkg/kube/client.go, which only checks
     \`ResourcePolicyAnno\`. Stripping \`meta.helm.sh/*\` and
     \`app.kubernetes.io/managed-by\` does not prevent the deletion;
     those markers only matter for adoption checks on resources
     entering a manifest, not on resources leaving it.

     Likewise, helm-controller has no independent label-based prune
     for Helm-managed resources — the \`helm.toolkit.fluxcd.io/*\`
     labels are tracking metadata only, not a deletion gate.

  2. Even if the Secret survived the Helm/Flux delete pass,
     cert-manager still could not adopt it in place: the legacy
     Secret has \`type: Opaque\`, cert-manager writes
     \`type: kubernetes.io/tls\`, and Secret.type is immutable in
     Kubernetes. The Certificate reconcile would fail with
     \"field is immutable\" and never become Ready.

The migration converges anyway because the Job is a no-op: Helm
deletes the old Opaque Secret, cert-manager mints a fresh one of
the right type, and the Deployment rolls in the same upgrade
(its podTemplate carries the new \`checksum/tls-cert\` annotation,
which is the sha of the runtime Secret and therefore differs the
first time cert-manager writes new content). The webhook's
\`failurePolicy: Ignore\` makes the seconds-long window benign.

Delete the migrator entirely: template file, RBAC (ServiceAccount +
Role + RoleBinding), the hardcoded clastix/kubectl image reference,
and the four helm-unittest cases pinning its hook wiring / RBAC
scope. ~200 lines removed, one less pinned image, and the
documented migration flow now matches what actually happens.

Existing helm-unittest suite: 15/15 pass (was 19 with the migrator
tests; removed 4 that referenced the retired template).

Signed-off-by: Ivan Okhotnikov <ivan.okhotnikov@aenix.io>
2026-07-02 18:57:01 +03:00
..
2026-06-22 10:55:37 +00:00
2026-03-25 15:57:25 +05:00
2026-06-22 10:55:37 +00:00
2026-06-22 10:55:37 +00:00
2026-02-10 20:19:03 +01:00
2026-06-22 10:55:37 +00:00
2026-03-25 15:57:25 +05:00