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

Helm 3 not installing custom CRDs #1023

Closed
brpaz opened this issue Mar 8, 2020 · 13 comments · Fixed by #1102
Closed

Helm 3 not installing custom CRDs #1023

brpaz opened this issue Mar 8, 2020 · 13 comments · Fixed by #1102
Assignees
Labels
area/community Related to ability of community to participate in pulumi-kubernetes development kind/bug Some behavior is incorrect or out of spec
Milestone

Comments

@brpaz
Copy link

brpaz commented Mar 8, 2020

Problem description

I am trying to install cert-manager with Helm and Pulumi.

I have this configuration:

const certManagerChart = new k8s.helm.v3.Chart(
  "cert-manager",
  {
    chart: "cert-manager",
    repo: "jetstack",
    version: "v0.13.0",
    namespace: certManagerNs.id,
    values: {
      ingressShim: {
        defaultIssuerName: "letsencrypt-prod",
        defaultIssuerKind: "ClusterIssuer"
      }
    }
  },
  { providers: { kubernetes: provider }, dependsOn: cluster }
);

The custom CRDs provided by the chart are not being installed. I have exactly the same setup in Terraform and it works, so I guess it´s an issue of Pulumi Helm resource and not the chart.

If I understood correctly Pulumi uses helm template under the hood. I think the issue might be that the command doesn´t allow specifying the "include crds" flag. (see https://github.com/helm/helm/pull/7138/files)

@nesl247
Copy link

nesl247 commented Mar 16, 2020

Just ran into this myself. It is expected that Pulumi would install the CRDs automatically the same as helm would.

I think the big fix would be to use the 1.0.0 of the terraform-provider-helm.

@lblackstone
Copy link
Member

I think the issue might be that the command doesn´t allow specifying the "include crds" flag.

Yes, this is correct. We'd need to plumb that option through to the SDK.

@rhyek
Copy link

rhyek commented Mar 19, 2020

Could this be related to #993? In my case it's not installing any resources at all.

@brpaz
Copy link
Author

brpaz commented Mar 21, 2020

@rhyek I don´t think so. This issue is related with Custom CRDs and the reason is well identified by the missing support for the "include crds" flag.

I have installed like 5 or 6 Helm charts into my cluster without any problem.

@dz-pyps
Copy link

dz-pyps commented Apr 28, 2020

I can confirm that with pulumi v2.0.0 and pulumi-kubernetes==2.0.0 (Python SDK), CRDs are not installed. I tried to install the traefik chart https://github.com/containous/traefik-helm-chart/tree/master/traefik

@lblackstone lblackstone assigned jaxxstorm and unassigned lblackstone Apr 28, 2020
@lblackstone lblackstone added this to the 0.35 milestone Apr 28, 2020
@lblackstone lblackstone added area/community Related to ability of community to participate in pulumi-kubernetes development kind/bug Some behavior is incorrect or out of spec labels Apr 28, 2020
@jaxxstorm
Copy link
Contributor

We're going to add this to the provider, but if you come here and you're trying to install a chart with CRDs, a workaround is to install them using ConfigFile. As an example (in typescript):

const crds = new k8s.yaml.ConfigFile("crds", {
    file: "https://github.com/jetstack/cert-manager/releases/download/v0.14.1/cert-manager.crds.yaml",
}, { provider: provider })

const certManager = new k8s.helm.v2.Chart("cert-manager",
    {
        namespace: namespace.metadata.name,
        chart: "cert-manager",
        version: "v0.14.2",
        fetchOpts: { repo: "https://charts.jetstack.io" },
        values: {}
    },
    {
        providers: { kubernetes: provider },
        dependsOn: [crds]
    },
)

@dz-pyps
Copy link

dz-pyps commented Apr 28, 2020

@jaxxstorm, I did precisely that. Nevertheless, as you can imagine, it is inconvenient to download the CRDs locally and keep track of the changes in the target repository.

crds_pulumi_objects = []
for item in glob.glob(traefik_cdrs_directory + '/*'):
    if '.yaml' in item:
        crd_to_apply = ConfigFile(
            'traefik_crd_' + item.split('/')[-1].split('.')[0],
            item,
            opts=ResourceOptions(
                depends_on=[
                    traefik_namespace,
                ],
                provider=k8s_provider,
            )
        )
        crds_pulumi_objects.append(crd_to_apply)

Output.all(
    traefik_dashboard_out_file_location,
    traefik_dashboard_j2_location,
).apply(pulumi_output_renderer_traefik)

apply_traefik_ingress_route = ConfigFile(
    'traefik_ingress_route',
    traefik_dashboard_out_file_location,
    opts=ResourceOptions(
        depends_on=[
            traefik_namespace,
            *crds_pulumi_objects,
        ],
        provider=k8s_provider,
    )
)

jaxxstorm added a commit that referenced this issue May 6, 2020
This PR adds a mechanism to detect if helm v3 is being used when the
chart is rendered. If it is, it includes the `--include-crds` flag so
that the CRDs are rendered as part of the YAML stream.

Fixes #1023
jaxxstorm added a commit that referenced this issue May 9, 2020
# This is the 1st commit message:

Use include-crds flags when using helm v3

This PR adds a mechanism to detect if helm v3 is being used when the
chart is rendered. If it is, it includes the `--include-crds` flag so
that the CRDs are rendered as part of the YAML stream.

Fixes #1023

# The commit message #2 will be skipped:

# Remove version hack

# The commit message #3 will be skipped:

# Remove unneeded execSync options
jaxxstorm added a commit that referenced this issue May 9, 2020
This PR adds a mechanism to detect if helm v3 is being used when the
chart is rendered. If it is, it includes the `--include-crds` flag so
that the CRDs are rendered as part of the YAML stream.

Fixes #1023
@leezen leezen modified the milestones: 0.35, 0.36 May 11, 2020
@jaxxstorm
Copy link
Contributor

This should be available in the next release of the provider!

@dz-pyps
Copy link

dz-pyps commented May 25, 2020

@jaxxstorm, I've updated pulumi-kubernetes to 2.2.0, but CRDs are still not installed by default.
I used traefik chart https://github.com/containous/traefik-helm-chart

@jaxxstorm
Copy link
Contributor

@jaxxstorm, I've updated pulumi-kubernetes to 2.2.0, but CRDs are still not installed by default.
I used traefik chart https://github.com/containous/traefik-helm-chart

which version of helm are you using locally?

@dz-pyps
Copy link

dz-pyps commented May 25, 2020

@jaxxstorm version.BuildInfo{Version:"v3.2.1", GitCommit:"fe51cd1e31e6a202cba7dead9552a6d418ded79a", GitTreeState:"clean", GoVersion:"go1.13.10"}

@dz-pyps
Copy link

dz-pyps commented Feb 15, 2021

@jaxxstorm, CRDs from this chart https://github.com/prometheus-community/helm-charts/tree/main/charts/kube-prometheus-stack do not get installed first, so dependant resources fail.

@logileifs
Copy link

I'm having the same issue as @dz-pyps using pulumi-kubernetes, python and helm 3. I'm trying to install argocd helm chart which contains CRDs and CRs. CRDs don't get installed and all the CRs fail to be installed because the definitions are missing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/community Related to ability of community to participate in pulumi-kubernetes development kind/bug Some behavior is incorrect or out of spec
Projects
None yet
Development

Successfully merging a pull request may close this issue.

8 participants