Skip to content

Commit cd6a9b3

Browse files
committed
fix(platform): correct what disabledPackages does to ouroboros
Both the publishing.proxyProtocol comment in values.yaml and the disable-hazard guard comment in the system bundle told operators that adding a package name to bundles.disabledPackages triggers the vendored ouroboros chart's pre-delete Corefile cleanup hook, alongside an explicit `kubectl delete package.cozystack.io cozystack.ouroboros`. It does not. A name in disabledPackages only makes the rendering helper in _helpers.tpl skip emitting the Package document, which is the same suppression that leaving proxyProtocol false already performs. Every emitted Package carries helm.sh/resource-policy: keep, so Helm does not prune the Package it has stopped rendering — that annotation was added precisely to stop disabling a package from deleting it. The Package CR survives, the HelmRelease it owns via ownerReference survives with it, ouroboros keeps running and keeps re-applying its rewrite block to kube-system/coredns, and the pre-delete hook never runs because nothing uninstalls the release. No platform values setting reaches that hook; the operator has to delete the Package CR. Anyone who followed the old advice was left with ouroboros still installed and, on the proxyProtocol false transition, still facing the render guard with no idea why. Pins the behaviour with a case asserting the guard still fails while cozystack.ouroboros sits in disabledPackages and the Package CR is live. Assisted-by: LLM Signed-off-by: Aleksei Sviridkin <[email protected]>
1 parent 86d62bb commit cd6a9b3

3 files changed

Lines changed: 38 additions & 7 deletions

File tree

‎packages/core/platform/templates/bundles/system.yaml‎

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -186,11 +186,14 @@
186186
present-on-cluster Package. ouroboros keeps running, the
187187
cleanup hook never fires, the rewrite block stays live. The
188188
operator must `kubectl delete package.cozystack.io
189-
cozystack.ouroboros` (or add the package to
190-
bundles.disabledPackages) for the chart to actually uninstall
191-
and the hook to actually clean up. This guard fails the render
192-
on the dangerous transition path so the operator confirms
193-
they understand the asymmetry by setting
189+
cozystack.ouroboros` for the chart to actually uninstall and
190+
the hook to actually clean up. Adding the name to
191+
bundles.disabledPackages is not a second path to that: it only
192+
stops _helpers.tpl emitting the Package document, which is the
193+
same suppression the flag flip already performs, and
194+
resource-policy: keep leaves the live Package running. This
195+
guard fails the render on the dangerous transition path so the
196+
operator confirms they understand the asymmetry by setting
194197
publishing.proxyProtocolAcknowledgeUnclean: true.
195198
Known hole: an operator who manually `kubectl delete package
196199
cozystack.ouroboros` before flipping the flag back bypasses the

‎packages/core/platform/tests/bundles_proxy_protocol_lookup_test.yaml‎

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,3 +78,23 @@ tests:
7878
path: metadata.annotations["helm.sh/resource-policy"]
7979
value: keep
8080

81+
# bundles.disabledPackages is not a route out of the guard. A name in
82+
# that list only stops _helpers.tpl emitting the Package document; the
83+
# guard keys off a lookup for the live Package CR, which the list
84+
# never touches. An operator who reaches for disabledPackages instead
85+
# of `kubectl delete package` still gets the failure, and ouroboros is
86+
# still installed when they get it.
87+
- it: still fails when cozystack.ouroboros is in bundles.disabledPackages but the Package CR is live
88+
set:
89+
bundles:
90+
system:
91+
enabled: true
92+
variant: isp-full
93+
disabledPackages:
94+
- cozystack.ouroboros
95+
publishing:
96+
proxyProtocol: false
97+
proxyProtocolAcknowledgeUnclean: false
98+
asserts:
99+
- failedTemplate:
100+
errorPattern: "publishing.proxyProtocol was previously enabled.*helm.sh/resource-policy: keep leaves the existing Package"

‎packages/core/platform/values.yaml‎

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -252,8 +252,7 @@ publishing:
252252
#
253253
# kubectl delete package.cozystack.io cozystack.ouroboros
254254
#
255-
# or adds the package name to bundles.disabledPackages. THAT is the
256-
# path that triggers the chart's pre-delete Helm hook
255+
# THAT is the path that triggers the chart's pre-delete Helm hook
257256
# (charts/ouroboros/templates/coredns-cleanup-hook.yaml, vendored at
258257
# 0.8.0) — the hook quiesces the controller, sed-strips the
259258
# BEGIN/END block from the live kube-system/coredns Corefile, and
@@ -262,6 +261,15 @@ publishing:
262261
# the normal disable path. Documentation of the hook's exact
263262
# behaviour lives in the upstream chart's README.
264263
#
264+
# bundles.disabledPackages does NOT do this. Putting this name in
265+
# that list only makes templates/_helpers.tpl skip emitting the
266+
# Package document — the same suppression as leaving proxyProtocol
267+
# false — and resource-policy: keep then stops Helm pruning a
268+
# Package it no longer renders. The Package CR stays, so does the
269+
# HelmRelease it owns, ouroboros keeps running, and the pre-delete
270+
# hook never fires. No platform values setting reaches that hook:
271+
# the operator has to delete the Package CR.
272+
#
265273
# Manual cleanup recipe (only if the chart's pre-delete hook fails
266274
# to land — controller pod stuck in CrashLoop blocking the quiesce
267275
# step, ConfigMap RBAC drift on the namespace, helm uninstall

0 commit comments

Comments
 (0)