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

Helm3 Fetch Bug when multiple directories extracted #1046

Closed
mitchellmaler opened this issue Mar 25, 2020 · 5 comments
Closed

Helm3 Fetch Bug when multiple directories extracted #1046

mitchellmaler opened this issue Mar 25, 2020 · 5 comments
Assignees
Labels
kind/bug Some behavior is incorrect or out of spec language/dotnet

Comments

@mitchellmaler
Copy link

mitchellmaler commented Mar 25, 2020

Problem description

Currently the .NET helm extraction/fetch logic expects the directory to contain only a single directory after extraction. You can see that here: https://github.com/pulumi/pulumi-kubernetes/blob/master/sdk/dotnet/Helm/ChartBase.cs#L68
The issue is the chart I am pulling down when untared actually extracts to two directories. One holding the contents and another completely empty. Due to that expectation of the directory being the first in the list it breaks the resource render due to the first dir being empty.

The helm chart I am having issues with is the BigIP F5 Ctrl chart.

You can run the exec command below to view it extracts two directories and not a single one.
helm fetch "f5-bigip-ctlr" --untar --version "0.0.7" --repo "https://f5networks.github.io/charts/stable"

Errors & Logs

error: Pulumi.ResourceException: Error: open /var/folders/c9/0pv851zj5n5brhybbs7zv2qr0000gp/T/sqvy5mop.n05/f5-bigip-ctlr-0.0.7.tgz/values.yaml: no such file or directory
    at Pulumi.Kubernetes.Helm.ChartBase.<>c__DisplayClass0_0.<.ctor>b__1(ValueTuple`2 values)
    at Pulumi.Output`1.ApplyHelperAsync[U](Task`1 dataTask, Func`2 func)
    at Pulumi.Output`1.Pulumi.IOutput.GetDataAsync()
    at Pulumi.Serialization.Serializer.SerializeAsync(String ctx, Object prop)
    at Pulumi.Deployment.SerializeFilteredPropertiesAsync(String label, IDictionary`2 args, Predicate`1 acceptKey)
    at Pulumi.Deployment.SerializeAllPropertiesAsync(String label, IDictionary`2 args)
    at Pulumi.Deployment.RegisterResourceOutputsAsync(Resource resource, Output`1 outputs)
    at Pulumi.Deployment.Runner.WhileRunningAsync()

Affected product version(s)

v1.6.0

Reproducing the issue

var f5BigIpCtrl = new Pulumi.Kubernetes.Helm.V3.Chart("f5BigIpCtrl",
    new ChartArgs
    {
        Chart = "f5-bigip-ctlr",
        Namespace = "kube-system",
        FetchOptions = new ChartFetchArgs
        {
            Repo = "https://f5networks.github.io/charts/stable"
        }
    },
    new ComponentResourceOptions
    {
        Provider = kubernetesProvider
    });

Suggestions for a fix

Update the logic to figure out what directory holds the chart.yaml and/or chart files.
https://github.com/pulumi/pulumi-kubernetes/blob/master/sdk/dotnet/Helm/ChartBase.cs#L68

@mitchellmaler mitchellmaler changed the title .NET Helm3 Fetch Bug on untar when multiple directories .NET Helm3 Fetch Bug on untar when multiple directories extracted Mar 25, 2020
@mitchellmaler mitchellmaler changed the title .NET Helm3 Fetch Bug on untar when multiple directories extracted .NET Helm3 Fetch Bug when multiple directories extracted Mar 25, 2020
@mitchellmaler mitchellmaler changed the title .NET Helm3 Fetch Bug when multiple directories extracted Helm3 Fetch Bug when multiple directories extracted Mar 31, 2020
@mitchellmaler
Copy link
Author

Just ran into this issue with the new rancher version.
helm fetch "rancher" --untar --version "2.4.0" --repo "https://releases.rancher.com/server-charts/latest"
This extracts two directories 'rancher' and 'rancher-2.4.0.tgz'. I am unable to upgrade to the latest version of rancher now.

@lblackstone lblackstone added kind/bug Some behavior is incorrect or out of spec language/dotnet labels Mar 31, 2020
@lblackstone
Copy link
Member

@mikhailshilkov This issue appears to be specific to the .NET implementation. I confirmed that the following works:

new k8s.helm.v3.Chart(
    "rancher",
    {
        repo: "rancher-latest",
        version: "2.4.0",
        chart: "rancher",
    },
);

@mitchellmaler
Copy link
Author

The issue occurs when the fetch options repo are provided. It also depends on the ordering of the directoris in the temp dir which it could give you the correct directory. The nodejs sdk also expects a single dir at index 0 which is no true if the repo fetch option is set. https://github.com/pulumi/pulumi-kubernetes/blob/master/sdk/nodejs/helm/v2/helm.ts#L172

new k8s.helm.v3.Chart(
  "rancher",
  {
      version: "2.4.0",
      chart: "rancher",
      fetchOpts: {
        repo:  "https://releases.rancher.com/server-charts/latest"
      }
  },
);

The work around is to add the helm repo before hand instead of directly specifying it in the fetch options.

This is without the repo fetch option set and it extracts a single directory
helm fetch rancher-latest/rancher --untar --version 2.4.0 --destination ...
This runs when the repo fetch options is set and extracts multiple directories. Seems more like a helm bug.
helm fetch "rancher" --untar --version "2.4.0" --repo "https://releases.rancher.com/server-charts/latest" --destination ...

@ojoggerst
Copy link

ojoggerst commented Apr 14, 2020

I can confirm the same behavior for python! It seems when specifying the "--repo" fetch option it will extract two folders, one empty and one with the chart, as already described previously by @mitchellmaler.

Python example:

pulumi_kubernetes.helm.v3.Chart(
            release_name = "cert-manager",
            config = ChartOpts(
                chart = "cert-manager",
                namespace = "cert-manager",
                version="v0.14.1",
                fetch_opts = FetchOpts(
                    repo = "https://charts.jetstack.io"
                )
            )
        )

Compare the directorties of:

helm repo add jetstack https://charts.jetstack.io
helm fetch --untar jetstack/cert-manager

and

helm fetch --untar --repo https://charts.jetstack.io cert-manager

I can also confirm the workaround of @mitchellmaler is working by adding helm repo add jetstack https://charts.jetstack.io to your local repo.

pulumi_kubernetes.helm.v3.Chart(
            release_name = "cert-manager",
            config = ChartOpts(
                chart = "jetstack/cert-manager",
                namespace = "cert-manager",
                version="v0.14.1"
            )
        )

In the python code of pulumi-kubernetes it also takes the first directory it can find
(https://github.com/pulumi/pulumi-kubernetes/blob/master/sdk/python/pulumi_kubernetes/helm/v2/helm.py#L326) which seems to be not correct.

@lblackstone
Copy link
Member

This should be fixed by #1064

This change isn't yet part of a tagged release, but you can use a dev release to test it out now.

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 language/dotnet
Projects
None yet
Development

No branches or pull requests

4 participants