Skip to content

Upgrade --install quietly fails to delete resources #11375

Closed

Description

@franceschongg

When helm.Upgrade(...) is called, resources that are not part of the chart will quietly fail if the role does not have the delete permission.

The source code that does this is here:

helm/pkg/kube/client.go

Lines 292 to 295 in 8199db3

if err := deleteResource(info); err != nil {
c.Log("Failed to delete %q, err: %s", info.ObjectName(), err)
continue
}

To reproduce:

  1. Have a chart that includes some resource (let's say CronJob) in this instance
  2. The role that does the helm.Upgrade does not have the permission to delete cronJobs
  3. Do another upgrade -> upgrade passes without the resource deleted.

Output of helm version:
version.BuildInfo{Version:"v3.8.1", GitCommit:"5cb9af4b1b271d11d7a97a71df3ac337dd94ad37", GitTreeState:"clean", GoVersion:"go1.17.8"}

Output of kubectl version:
Client Version: version.Info{Major:"1", Minor:"22", GitVersion:"v1.22.5", GitCommit:"5c99e2ac2ff9a3c549d9ca665e7bc05a3e18f07e", GitTreeState:"clean", BuildDate:"2021-12-16T08:38:33Z", GoVersion:"go1.16.12", Compiler:"gc", Platform:"darwin/amd64"}

Cloud Provider/Platform (AKS, GKE, Minikube etc.):
EKS

Activity

  1. joejulian commented on Sep 23, 2022

    @joejulian
    Contributor

    See #7929

  2. github-actions commented on Dec 23, 2022

    @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.

  3. joejulian commented on Dec 24, 2022

    @joejulian
    Contributor

    That Log call seems to imply it doesn't quietly fail. Are you saying that the message is never displayed?

  4. franceschongg commented on Dec 30, 2022

    @franceschongg
    Author

    It quietly failed until --debug mode was enabled for the log to appear.

    The message was displayed once the flag was passed in. The issue was stale resources were left there if the role attempting to delete the resource did not have permissions to do so.

  5. joejulian commented on Jan 15, 2023

    @joejulian
    Contributor

    If the role attempting to delete didn't have permissions to delete, did it even have list permissions? If it couldn't be listed it would be considered deleted already.

  6. franceschongg commented on Jan 18, 2023

    @franceschongg
    Author

    Hm, it did have list permissions. It just didn't have the delete permission.

  7. joejulian commented on Jan 19, 2023

    @joejulian
    Contributor

    The Update function states:

    helm/pkg/kube/client.go

    Lines 221 to 223 in 8199db3

    // configuration that are not present in the target configuration. If an error
    // occurs, a Result will still be returned with the error, containing all
    // resource updates, creations, and deletions that were attempted. These can be

    but the delete section is the only one that this isn't true for. I'll change this to a bug.

  8. added
    help wanted
    bug
    good first issue
    and removed on Jan 19, 2023
  9. github-actions commented on Apr 20, 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.

  10. dayeguilaiye commented on Aug 12, 2023

    @dayeguilaiye
    Contributor

    @joejulian I'd like to raise a PR to fix this, but I'm new to helm, I wonder if my thought is right:

    We should deal with the error returned by deleteResource() just like updateResource() here:

    helm/pkg/kube/client.go

    Lines 417 to 418 in a3cbe35

    c.Log("error updating the resource %q:\n\t %v", info.Name, err)
    updateErrors = append(updateErrors, err.Error())

  11. CleverFool77 commented on Feb 4, 2025

    @CleverFool77

    What's the update on the bug? I see the PR hasn't been merged yet. Any progress ?

  12. benoittgt commented on Oct 14, 2025

    @benoittgt
    Contributor

    New proposal based on previous stale PR: #31393

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    buggood first issuehelp wantedkeep open

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions