Skip to content

Commit c150894

Browse files
fix(etcd): remove destructive post-upgrade cert-regeneration hook
The etcd chart shipped a `post-upgrade` Helm hook that `kubectl delete`d the etcd TLS chain (`etcd-{ca,peer-ca,client,peer,server}-tls`) and then deleted etcd pods on every chart upgrade, gated by a semver compare of an `etcd-deployed-version` ConfigMap against `2.6.1`. The hook was added as a one-shot migration for the chart `2.6.0 -> 2.6.1` transition. Since commit f871fbd ("Remove versions_map logic") all chart versions are stamped as `0.0.0+<git-hash>`, which per semver is always `< 2.6.1`. The gate therefore always resolves to "update certs", firing the destructive hook on every etcd upgrade. On clusters running Kamaji-managed tenant control planes this wipes the etcd CA, cert-manager re-issues it, and tenant kube-apiservers hit `x509: certificate signed by unknown authority` against `etcd.<ns>.svc:2379` until each tenant DataStore is manually re-reconciled. Commit 47d81f7 ("Disabled private key rotation in CA certs") already fixed the underlying `rotationPolicy: Always` issue the migration was papering over, so the hook has no remaining use. Remove the hook Job, its RBAC, the version ConfigMap it read, and add a helm-unittest suite under `packages/extra/etcd/tests/` that guards against re-introducing the hook or the version ConfigMap. Assisted-By: Claude <[email protected]> Signed-off-by: Myasnikov Daniil <[email protected]>
1 parent 358ac66 commit c150894

7 files changed

Lines changed: 37 additions & 93 deletions

File tree

‎packages/extra/etcd/Makefile‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,6 @@ include ../../../hack/package.mk
55
generate:
66
cozyvalues-gen -v values.yaml -s values.schema.json -r README.md
77
../../../hack/update-crd.sh
8+
9+
test:
10+
helm unittest .

‎packages/extra/etcd/templates/hook/job.yaml‎

Lines changed: 0 additions & 39 deletions
This file was deleted.

‎packages/extra/etcd/templates/hook/role.yaml‎

Lines changed: 0 additions & 26 deletions
This file was deleted.

‎packages/extra/etcd/templates/hook/rolebinding.yaml‎

Lines changed: 0 additions & 15 deletions
This file was deleted.

‎packages/extra/etcd/templates/hook/serviceaccount.yaml‎

Lines changed: 0 additions & 7 deletions
This file was deleted.

‎packages/extra/etcd/templates/version.yaml‎

Lines changed: 0 additions & 6 deletions
This file was deleted.
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
suite: etcd chart does not ship a destructive post-upgrade cert-regeneration hook
2+
3+
release:
4+
name: etcd
5+
namespace: tenant-root
6+
7+
templates:
8+
- templates/check-release-name.yaml
9+
- templates/dashboard-resourcemap.yaml
10+
- templates/datastore.yaml
11+
- templates/etcd-defrag.yaml
12+
- templates/hook/job.yaml
13+
- templates/podscrape.yaml
14+
- templates/prometheus-rules.yaml
15+
- templates/version.yaml
16+
17+
tests:
18+
- it: renders no Job named etcd-hook
19+
documentSelector:
20+
path: metadata.name
21+
value: etcd-hook
22+
skipEmptyTemplates: true
23+
asserts:
24+
- hasDocuments:
25+
count: 0
26+
27+
- it: renders no ConfigMap named etcd-deployed-version
28+
documentSelector:
29+
path: metadata.name
30+
value: etcd-deployed-version
31+
skipEmptyTemplates: true
32+
asserts:
33+
- hasDocuments:
34+
count: 0

0 commit comments

Comments
 (0)