Commit b55e978
committed
fix(pull-mode): do not commit helm stage when a chart failed this cycle
handleCharts in controllers/handlers_helm.go was committing the staged
ConfigurationBundles even when walkChartsAndDeploy returned an error
for one of the charts in the profile. Because staging had aborted
before the failing chart was added to the in-memory staging manager,
the commit produced a ConfigurationGroup missing the bundles for that
chart. The applier-manager on the managed cluster then treats the
missing bundles as "this release was removed from the profile" and
uninstalls the chart, removing the previously deployed resources from
the managed cluster.
The user-visible effect is that any pull-mode reconcile which fails
inside helm (helm values schema validation, template instantiation
error, unreachable chart repo, invalid semantic version from a
poisoned cache, etc.) does not just fail loudly: it silently tears
down the deployment that was working moments earlier. Issue
#1724 reported this for cert-manager
when the values ConfigMap referenced by valuesFrom was updated with a
values document that did not match the chart schema.
The two sibling handlers already handle this correctly:
* handlers_resources.go:151-155 returns on deployError before
CommitStagedResourcesForDeployment.
* handlers_kustomize.go:196-197 does the same.
This change aligns handlers_helm.go with that pattern: if
walkChartsAndDeploy returned a deployError, return it immediately
instead of committing a partial stage. The previously committed
ConfigurationGroup is left in place so the agent continues to run the
last known good state until a clean reconcile can complete.
updateClusterReportWithHelmReports is a no-op outside of DryRun sync
mode, so moving the deployError check ahead of it does not affect
non-DryRun reconciles. Staged-but-not-committed bundles are cleared
by DiscardStagedResourcesForDeployment at the top of the next
deployHelmCharts invocation (handlers_helm.go:159), so there is no
leak of in-memory staged state.
Refs: #17241 parent cc85fae commit b55e978
1 file changed
+15
-4
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
928 | 928 | | |
929 | 929 | | |
930 | 930 | | |
| 931 | + | |
| 932 | + | |
| 933 | + | |
| 934 | + | |
| 935 | + | |
| 936 | + | |
| 937 | + | |
| 938 | + | |
| 939 | + | |
| 940 | + | |
| 941 | + | |
| 942 | + | |
| 943 | + | |
| 944 | + | |
| 945 | + | |
931 | 946 | | |
932 | 947 | | |
933 | 948 | | |
| |||
937 | 952 | | |
938 | 953 | | |
939 | 954 | | |
940 | | - | |
941 | | - | |
942 | | - | |
943 | | - | |
944 | 955 | | |
945 | 956 | | |
946 | 957 | | |
| |||
0 commit comments