Skip to content

Permanent fix for helm release stuck with status "pending-upgrade" or "pending-rollback" #11863

Open

Description

@helmlover

It is a well known problem that (at least in helm3) helm releases may get stuck in states "pending-upgrade" or "pending-rollback".
In such cases, no new upgrades or rollbacks can be initiated anymore without manual interventions like deleting secrets or performing a helm delete or similar hacks.

Example Thread (Closed) without any real deeper thought root cause solution: #7476.
Actually at the end of said thread there are people creating PRs in third party repos automating described hacks into their applications.

Such stuck scenarios seem to happen when the helm client process gets terminated during an upgrade or rollback operation.

I have an idea for an implementation that would make the handling easier for the user and more overall more robust and in accordance with the already existing --timeout parameter.

  1. User executes helm upgrade/install --timeout restOfUpgradeOrInstallParameters.
    The TIMEOUT (along with the CURRENT_DATETIME) parameter gets transferred to k8s and will be stored along with other release information (most likely in the existing k8s secret that stores the helm history information)
  2. Now the command from step 1 gets terminated, the release gets stuck in the some pending state.
  3. User again executes helm upgrade --timeout
    Now helm checks from information stored in k8s, whether the pending-upgrade/pending rollback operation has already exceeded it's timeout, so there are two cases:
    if original timeout exceeded: I will apply my new manifests without further ado
    else: I will print the existing error that another operation is already in progress.

Before spending efforts on the code, I would like to ask for feedback from the helm developers/community.
Would such a PR be accepted?

Activity

  1. joejulian commented on Mar 2, 2023

    @joejulian
    Contributor

    What if a chart developer has a pre-upgrade hook that isn't idempotent?

  2. helmlover commented on Mar 6, 2023

    @helmlover
    Author

    @joejulian
    I would need to test this explicitly to be 100% sure, but my helm experience tells me that hooks are always re-executed on a retry.
    So this would remain like in the current code: If a user needs (for whatever reason) to retry a helm release installation, the hooks will always be executed.

    I have btw. an alternative fix idea that would allow for even faster retries than the original proposal:

    Alternative B
    Open each helm client operation that performs changes on the server (k8s), the client uploads a

    • unique_session_id (uuid)
    • locked_till value (datetime - will be something like the current datetimestamp + some safety period like 30s)

    Furthermore, it is the client's task to continuously update the locked_till value (every 10s or so).

    Now on each helm client operation, the client first checks if the locked_till value is in the past:
    If yes: mark old revision number as failed and proceed with "new" installation - without throwing any error (maybe a warning) that refers to the old installation.
    Else: Throw already existing error that there is already a concurrent installation being performed.

  3. joejulian commented on Mar 23, 2023

    @joejulian
    Contributor

    Well, if you'd like to contribute this, write up a Helm Improvement Proposal and if it gets merged, we can transition this issue to a feature.

  4. github-actions commented on Jun 22, 2023

    @github-actions

    This issue has been marked as stale because it has been open for 90 days with no activity. This thread will be automatically closed in 30 days if no further activity occurs.

  5. nosalan commented on Feb 27, 2024

    @nosalan

    Perhaps there should be a Helm command to convert Pending.. releases to Failed state.

  6. gerrnot commented on Jul 23, 2024

    @gerrnot
  7. gjenkins8 commented on Jul 27, 2024

    @gjenkins8
    Member

    HIP has been created, so will mark this as "keep open" while the HIP is under development

  8. yasanthae commented on Jun 3, 2025

    @yasanthae

    Still same.

  9. david0 commented on Jul 8, 2025

    @david0

    We are still struggling with that too. We do not like the fact that we have to run helm commands manually on production to work around this problem, so a fix would be really appreciated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions