Repository navigation
Description
Description
When using CancelHealthCheckOnNewRevision feature gate together with remediation strategy that allows retries and rollbacks, it is observed that canceling healtchecks produces an extra rollback that always gets interrupted (but not immediately).
This causes extra pod churn, and potentially other side effects, depending on what is installed by the chart.
It also wastes time in general, and pollutes helm history, as every healtcheck cancel produces 2 failed revisions instead of just 1.
NOTE: We do need rollbacks on actual deployment failures, so we can't change the strategy to RetryOnFailure.
Setup
-
Run helm-controller with
--feature-gates=CancelHealthCheckOnNewRevision=true(no DefaultToRetryOnFailure). -
Have a HelmRelease with remediation startegy like this:
spec:
install:
remediation:
retries: -1
upgrade:
remediation:
retries: 1
remediateLastFailure: true-
Have chart produce resources that require long enough upgrade/rollback, e.g. long startupProbe on pods.
Something above 30s should be enough. -
Deploy successful revision --
helm historylooks like this:
REVISION UPDATED STATUS CHART APP VERSION DESCRIPTION
1 Wed Jul 29 11:33:24 2026 deployed kyverno-3.8.2 v1.18.2 Install complete
Reproduction steps
- Start upgrade to new revision.
REVISION UPDATED STATUS CHART APP VERSION DESCRIPTION
1 Wed Jul 29 11:33:24 2026 deployed kyverno-3.8.2 v1.18.2 Install complete
2 Wed Jul 29 15:24:16 2026 pending-upgrade kyverno-3.8.2 v1.18.2 Preparing upgrade
- Interrupt upgrade with new changes - this starts a rollback:
REVISION UPDATED STATUS CHART APP VERSION DESCRIPTION
1 Wed Jul 29 11:33:24 2026 deployed kyverno-3.8.2 v1.18.2 Install complete
2 Wed Jul 29 15:24:16 2026 failed kyverno-3.8.2 v1.18.2 Upgrade "kyverno" failed: context canceled
3 Wed Jul 29 15:24:41 2026 pending-rollback kyverno-3.8.2 v1.18.2 Rollback to 1
- Continue to observe. After few seconds, rollback gets interrupted automatically with the same "context canceled", even though no changes were made. However, before it's interrupted it does start to create resources from revision "1" - this is the main problem and the cause of side effects. After canceling rollback, it proceeds to upgrade to the actual revision you deployed.
REVISION UPDATED STATUS CHART APP VERSION DESCRIPTION
1 Wed Jul 29 11:33:24 2026 superseded kyverno-3.8.2 v1.18.2 Install complete
2 Wed Jul 29 15:24:16 2026 failed kyverno-3.8.2 v1.18.2 Upgrade "kyverno" failed: context canceled
3 Wed Jul 29 15:24:41 2026 failed kyverno-3.8.2 v1.18.2 Release "kyverno" failed: context canceled
4 Wed Jul 29 15:25:08 2026 deployed kyverno-3.8.2 v1.18.2 Upgrade complete
This happens on every occasion when healtchecks get canceled.
Expected behavior
Instead of triggering rollback after canceled revision, it should directly go to deploying the new revision.
Environment
flux 2.9.3 (helm-controller 1.6.3).
Activity
ruslan-shaydullin commentedon Aug 29, 2026
Hi, I’d like to work on #1557, but before starting implementation I’d like to align on the intended semantics. My reading of the current flow is that enqueueing a new revision cancels the health check for an in-progress upgrade, Helm records the upgrade as a failed revision, and the atomic reconciler treats it like a regular failure and starts the configured rollback remediation. The rollback can then apply the previous manifest before it also encounters the cancelled context, resulting in an unnecessary rollback, resource churn, and another failed revision.
I propose a narrow exception only when the cancellation was caused by enqueueing a new revision: atomic reconciliation would stop before remediation and allow the next reconcile to process the new desired state. Regular upgrade failures and timeouts without a newly enqueued revision would continue to trigger the configured remediation.
I’d like to clarify three points: should this exception apply only to
upgrade → rollback, or also toinstall → uninstall? Should the cancelled operation still be stored as a failed Helm revision and increment the failure counter? If an enqueue occurs but the effective revision, generation, and values are unchanged, should the next reconcile retry the operation or continue with remediation?For testing, I plan to extend the existing cancellation integration test with rollback remediation and cover
v1 deployed → v2 upgrade cancelled by v3 → v3 deployed. The test would verify that no rollback action or event is emitted and that no additional rollback-generated Helm revision is created. I’ll also retain coverage confirming that a genuine upgrade failure still triggers rollback.artem-nefedov commentedon Sep 22, 2026
My opinion on this is "no", as I listed polluting helm history as one of the negatives. However, it's not that big of a deal if it is stored.
I don't fully understand other questions, so can't comment.
ruslan-shaydullin commentedon Oct 6, 2026
With #1605, after a canceled health check no rollback starts in the same reconciliation, so history is A superseded, B failed, C deployed, not four revisions. B is still failed since Helm records it, and the failure count still grows; a timeout with no new revision rolls back as before. Does that match what you expected? A run of the branch would help but is optional: it's on main, you're on 1.6.3.
artem-nefedov commentedon Oct 6, 2026
I don't know what failure count affects in case of B. From what I've seen, failure count is revision-specific, and since B is immediately replaced by C, there's no scenario where B failure count is important, so it doesn't matter if it's incremented or not (correct me if I'm wrong).
Going from the description, the behavior seems correct.
matheuscscp commentedon Oct 7, 2026
@artem-nefedov May I ask why rollbacks are a requirement for you?
artem-nefedov commentedon Oct 8, 2026
@matheuscscp I would say, pretty standard reason: to restore working configuration in case of a problem with minimal downtime. Similar reason why tools like Flagger/Argo Rollouts exist.
Additionally, we do have services that use Argo Rollouts with complex upgrade strategy. But the nuance is that, if rollout becomes degraded, it can only rollback pod spec, it won't revert other objects like ConfigMaps/etc. For us it's very important to revert everything atomically, and that's where helm rollback comes in when we fail upgrade based on rollout status.
New features such as custom CEL health checks and CancelHealthCheckOnNewRevision actually turned out to be very useful for this scenario. Before those, we had to use post-upgrade hook Job to check rollout status, and users were forced to wait the whole helm timeout every time before further changes could be made.
matheuscscp commentedon Oct 8, 2026
Hmm I think I was understanding this wrong. Please confirm if I understand now:
You want rollbacks, but not when a release action gets cancelled due to requeue.
Is that correct?
matheuscscp commentedon Oct 9, 2026
Or rather: you do when the chart/values did not change, and you don't otherwise?
artem-nefedov commentedon Oct 9, 2026
Uhh, this is getting confusing...
I think the simple description is: when one revision upgrade process gets canceled by a newer revision, there should not be a rollback before newer revision starts applying. Especially since that rollback is guaranteed to be interrupted midway, as seen from the description.
But if the revision progressed normally and failed healthchecks, it should trigger rollback to last successful.
Basically, the behavior @ruslan-shaydullin described in #1557 (comment) is correct.
matheuscscp commentedon Oct 9, 2026
The rollback is not guaranteed to be interrupted midway, we have enough control of the code to choose what to do. It's not the main reconciliation context that gets cancelled. It's a special one, injected inside the main reconciliation context (not extending it!). We can decide to make rollback run inside the same Reconcile() with a fresh context if we want to, but the solution proposed in #1605 may also work and be better. Please look at the two test cases we have there. Each one has a different event to trigger the health check cancellation. One test is changing inputs of the release, the other one is not. At the end of each test we assert the expected release history and they are identical. What differs for the two tests is that revision
3 deployedis a successful upgrade in the test where release inputs have changed, while revision3 deployedis a successful rollback in the test where release inputs have not changed. The tests assert thatlatest.Actionmatches the expected action (upgrade or rollback) on each test case.Note: This difference in behavior depending on whether or not release inputs have changed is part of our state machine in helm-controller, exists prior to #1605.
@artem-nefedov Please have a look at the tests in the PR and let me know if this is what you expect.
ruslan-shaydullin commentedon Oct 9, 2026
Added the
latest.Actioncheck to the first test in b1ad615: upgrade there, rollback in the second one. Both tests now assert the action as described above.