Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to import Helm Release #2014

Closed
kwohlfahrt opened this issue Jun 13, 2022 · 10 comments · Fixed by #2136
Closed

Unable to import Helm Release #2014

kwohlfahrt opened this issue Jun 13, 2022 · 10 comments · Fixed by #2136
Assignees
Labels
kind/bug Some behavior is incorrect or out of spec resolution/fixed This issue was fixed
Milestone

Comments

@kwohlfahrt
Copy link

What happened?

I am trying to import an existing Helm Release. However, this works neither through specifying { import: "namespace/release" } and using pulumi up, or using pulumi import.

Steps to reproduce

Install the Helm Release. In my case, this example (the repo was already present) is one but it has occurred with every repo I tried to import:

$ helm repo ls
NAME                	URL                                               
cilium              	https://helm.cilium.io/                           
nvdp                	https://nvidia.github.io/k8s-device-plugin        
$ helm repo update nvdp
$ helm upgrade nvidia-device-plugin nvdp/nvidia-device-plugin --namespace nvidia-device-plugin --version 0.12.0

Then, try either pulumi import kubernetes:helm.sh/v3:Release nvidia-device-plugin nvidia-device-plugin/nvidia-device-plugin, or pulumi up with the following configuration:

new k8s.helm.v3.Release("nvidia-device-plugin", {
  chart: "nvidia-device-plugin",
  version: "0.12.0",
  name: "nvidia-device-plugin",     
  namespace: "nvidia-device-plugin",
  repositoryOpts: { repo: "https://nvidia.github.io/k8s-device-plugin" },
  values: {                         
    nodeSelector: {                                                           
      "feature.node.kubernetes.io/pci-0302_10de.present": "true"
    }
  },                                                                     
}, { 
  import: "nvidia-device-plugin/nvidia-device-plugin",
})

Expected Behavior

I expect the resource to be imported.

Actual Behavior

Using the pulumi import command, I get the following error:

  kubernetes:helm.sh/v3:Release (nvidia-device-plugin):
    error: Preview failed: failed to load chart from temp directory: stat nvidia-device-plugin: no such file or directory

Using the pulumi up version, I see what looks like a successful import plan:

     Type                              Name                  Plan       Info
     pulumi:pulumi:Stack               k8s-scan                         2 warnings
 =   └─ kubernetes:helm.sh/v3:Release  nvidia-device-plugin  import     [diff: +repositoryOpts]; 1 warning

However, when trying the import, I get:

  kubernetes:helm.sh/v3:Release (nvidia-device-plugin):
    error: inputs to import do not match the existing resource

Versions used

CLI          
Version      3.31.0
Go Version   go1.17.9
Go Compiler  gc

Plugins
NAME        VERSION
kubernetes  3.19.3
nodejs      unknown

Additional context

I can kind of work around the issue with the following:

$ helm pull nvdp/nvidia-device-plugin
$ mv nvidia-device-plugin-0.12.0.tgz nvidia-device-plugin

This creates a copy of the Helm archive in the local directory, with the name nvidia-device-plugin. But it's a very manual and quite hacky workaround.

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

@kwohlfahrt kwohlfahrt added kind/bug Some behavior is incorrect or out of spec needs-triage Needs attention from the triage team labels Jun 13, 2022
@stack72 stack72 removed the needs-triage Needs attention from the triage team label Jun 16, 2022
@stack72
Copy link
Contributor

stack72 commented Jun 16, 2022

Hey @kwohlfahrt

My apologies for this issue - this certainly feels like a bug and something we need to get fixed up - I need to talk to the team about this to ensure that we get the correct fix in place here

I will leave this open of course so that you can track the progress of the work

Paul

@meteorops-taranis-michael-zion
Copy link

meteorops-taranis-michael-zion commented Jul 4, 2022

Stumbled exactly the same behavior when running pulumi import:

    error: Preview failed: failed to load chart from temp directory: stat ingress-nginx: no such file or directory

@meteorops-taranis-michael-zion
Copy link

meteorops-taranis-michael-zion commented Jul 31, 2022

Hey guys, did this issue get in the roadmap or prioritized?
For us it's a crucial fix in order to start using Pulumi Helm Releases.

@viveklak viveklak self-assigned this Aug 9, 2022
@viveklak viveklak added this to the 0.76 milestone Aug 9, 2022
@viveklak
Copy link
Contributor

Apologies for the delays here. The main issue is that helm itself doesn't record chart information in the release which makes it impossible for us to support a soup-to-nuts import with the repository information. In order to provide some meaningful information as part of the release creation process we do some degree of introspection on the chart but the same code path is entered during imports where this information is missing, causing issues. We have a potential fix in #2136 which seems to work well for the above scenarios. I will update this issue when that is ready to be merged.

@stack72 stack72 modified the milestones: 0.76, 0.77 Aug 15, 2022
@pulumi-bot pulumi-bot added the resolution/fixed This issue was fixed label Aug 15, 2022
@viveklak viveklak modified the milestones: 0.77, 0.76 Aug 15, 2022
@ami-descope
Copy link

im on 3.80.x and still can't import the helm release, is there any workaround?

@dbmora
Copy link

dbmora commented Oct 27, 2023

Was this fixed? I still have to do the hack to get it to import properly:

helm pull rook-release/rook-ceph
mv rook-ceph-v1.12.5.tgz rook-ceph
pulumi import kubernetes:helm.sh/v3:Release rook-ceph rook-ceph/rook-ceph --stack dev
# pulumi version
v3.91.0

@ami-descope
Copy link

Thank you so much for this workaround you saved me a tons of headaches editing state files manually

@ami-descope
Copy link

one thing i can't get pass is that its importing using the default provider of k8s, can't specify another provider urn tried any other combo like admin=URN and it doesnt work

@ami-descope
Copy link

i finally got it with

pulumi import kubernetes:helm.sh/v3:Release "${RESOURCE_NAME}" "kube-system/${helmRelease}" --protect=false --diff --parent "parent=${parent}" --provider "admin=${provider_urn}"

@ami-descope
Copy link

since this was hard to complete i documented it here in my blog post
https://medium.com/@amimahloof/importing-pulumi-helm-release-6c31f41df866

I understand that once this is fixed we won't need that but this is still an issue, and we need this to be re-opened, perhaps it was a regression that remove the fix 🤷

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Some behavior is incorrect or out of spec resolution/fixed This issue was fixed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants