pulumi / pulumi-kubernetes

A Pulumi resource provider for Kubernetes to manage API resources and workloads in running clusters
https://www.pulumi.com/docs/reference/clouds/kubernetes/
Apache License 2.0
414 stars 116 forks source link

Upgrading a pre-existing Helm Release results in "error: cannot re-use a name that is still in use" #2116

Open dirien opened 2 years ago

dirien commented 2 years ago

What happened?

Hi everyone,

I have the situation, where I want to upgrade an existing Helm release. This release is not deployed via Pulumi.

When I use the helm cli and add the flag --reuse-values everything works as expected.

In Pulumi, it results in error -> error: cannot re-use a name that is still in use

 cilium:
    type: kubernetes:helm.sh/v3:Release
    properties:
      namespace: kube-system
      chart: cilium
      name: cilium
      reuseValues: true
      forceUpdate: true
      version: ${cilium-version}
      repositoryOpts:
        repo: https://helm.cilium.io/
      values:
        hubble:
          ui:
            enabled: true
          relay:
            enabled: true
    options:
      provider: ${k8s-provider}

Could be related to https://github.com/pulumi/pulumi-kubernetes/issues/1727

Steps to reproduce

Create an K8s Cluster and deploy an helm chart via cli.

Try to upgrade it via Pulumi adding the reuseValues flag to it

Expected Behavior

Upgrades the existing Helm Release

Actual Behavior

error: cannot re-use a name that is still in use

Versions used

v3.37.2

Additional context

-

Contributing

Vote on this issue by adding a 👍 reaction. To contribute a fix for this issue, leave a comment (and link to your pull request, if you've opened one already).

EronWright commented 12 months ago

I take this issue to be an enhancement request, asking that the Helm Release resource automatically import an existing Helm release. Today we support various import strategies as outlined in the documentation.

A related enhancement would be to improve the error message, e.g. to suggest the use of importation.

didlawowo commented 11 months ago

it's a serious problem when you manage a lot of different cluster / provider. if you change the provider for any reason pulumi want to update the release but canno't manage the upgrade correctly

it make me feel the helm feature of pulumi is useless in production context cause it stuck all the stack

martinmesserli commented 9 months ago

I have the same problem with the error "cannot re-use a name that is still in use", and it is blocking me on already installed clusters. One of the failing charts is using timescaledb and uses persistent volumes which have important data, so I cannot just simply delete the Helm release manually with the CLI and let it recreate by Pulumi. I also used the Release Args Parameter "Replace = true" ("Re-use the given name, even if that name is already used. This is unsafe in production"), it gives me the same error. I am using Pulumi.Kubernetes 4.8.1 on .NET Core 6. @EronWright Is there any piece of information I missed to fix this issue?

EronWright commented 7 months ago

@martinmesserli it sounds like you should import the release by using the import option on the Release resource. This should be non-disruptive.

allschu commented 2 months ago

This is an issue which is still very awful, any process on this?

EronWright commented 3 weeks ago

There seems to be two problems described here:

  1. If a Helm release with the same name already exists, the user gets "cannot re-use a name that is still in use". The replace flag has no impact in this case because it forces Helm to replace only failed or uninstalled releases, not healthy releases.
  2. When the provider is replaced, the Helm release is unexpectedly replaced, and there may be an ordering problem (delete-before-replace).

I believe that the proper solution is to use pulumi import to bring an existing Helm release under management. One shouldn't expect Pulumi to silently do that.