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

Pulumi fails to generate YAML for external-dns Helm chart #1928

Closed
Dysproz opened this issue Mar 11, 2022 · 3 comments
Closed

Pulumi fails to generate YAML for external-dns Helm chart #1928

Dysproz opened this issue Mar 11, 2022 · 3 comments
Assignees
Labels
area/helm kind/bug Some behavior is incorrect or out of spec mro2 Monica's list of 2st tier overlay related issues

Comments

@Dysproz
Copy link

Dysproz commented Mar 11, 2022

Hello!

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

Issue details

I'm trying to deploy helm chart using pulumi to a EKS cluster.
I successfully wrote code for a few charts now, but I have a problem with external-dns chart.
Apparently, when I try to deploy it, it fails on rendering deployment template. with error:

running error: invocation of kubernetes:helm:template returned an error: failed to generate YAML for specified Helm chart: failed to create chart from template: execution error at (external-dns/templates/deployment.yaml:65:24): A provider is required to deploy the chart

Should I install some additional provider, or is it some problem in Helm implementation in pulumi itself?

Below code with ComponentResource - it takes as an argument classic AWS EKS cluster.

Steps to reproduce

import { all, ComponentResource, ComponentResourceOptions, Config, Input, output, Output } from "@pulumi/pulumi";
import { Chart } from '@pulumi/kubernetes/helm/v3';
import { Namespace } from '@pulumi/kubernetes/core/v1';
import { Cluster } from "@pulumi/aws/eks";
import { Provider } from "@pulumi/kubernetes";
import { generateKubeconfig } from "../../aws/eks/utils";

export interface TestHelmInputs {
    cluster: Cluster
}

export class TestHelm extends ComponentResource {

    ExternalDNSNamespace: Output<Namespace>;
    ExternalDNSChart: Output<Chart>;

    constructor(
        name: string,
        args: TestHelmInputs,
        opts?: ComponentResourceOptions
    ) {
        super("test:helm:dependencies:dependencies", name, {}, opts);
        let config = new Config();
        let cloud = config.require("cloud");
        let region = config.require(`region`);
        let env = config.require(`env`);

        const kubeconfig = output(generateKubeconfig(args.cluster.name, args.cluster.endpoint, args.cluster.certificateAuthority.data)).apply(JSON.stringify)
        const provider = new Provider("dependencies-custom-provider", { kubeconfig: kubeconfig });

        this.ExternalDNSNamespace = output(new Namespace("external-dns", {
            metadata: {
                name: "external-dns"
            }
        }, {
            provider: provider,
            dependsOn: args.cluster
        }))

        this.ExternalDNSChart = output(new Chart("external-dns-chart", {
            chart: "external-dns",
            namespace: "ingress-nginx",
            fetchOpts: {
                repo: "https://charts.bitnami.com/bitnami",
            },
            version: "v1.2.0",
            values: {
                extraArgs: [
                    "--aws-zone-type=public",
                    "--registry=txt",
                    `--txt-owner-id=${args.cluster.name}`,
                    "--annotation-filter=external-dns-ignore notin (true)",
                    `--domain-filter=${cloud}-${region}.test-${env}.net`,
                    "--events"
                ],
                env: [
                    {
                        name: "AWS_ACCESS_KEY_ID",
                        valueFrom: {
                            secretKeyRef: {
                                name: "dns-route53",
                                key: "accesskey"
                            }
                        }
                    },
                    {
                        name: "AWS_SECRET_ACCESS_KEY",
                        valueFrom: {
                            secretKeyRef: {
                                name: "dns-route53",
                                key: "secretkey"
                            }
                        }
                    }
                ],
                podAnnotations: {
                    "logging.starburstdata.io/es-index-group": "externaldns"
                },
                interval: "30m0s"
            },
        }, {
            provider: provider,
            dependsOn: [args.cluster, this.ExternalDNSNamespace]
        }))


        this.registerOutputs()
    }
}

  1. Create classic EKS cluster and try to deploy above component resource
  2. Try to create/update stack

Expected: Helm chart is properly deployed into the cluster
Actual: Fails with error:

running error: invocation of kubernetes:helm:template returned an error: failed to generate YAML for specified Helm chart: failed to create chart from template: execution error at (external-dns/templates/deployment.yaml:65:24): A provider is required to deploy the chart
@Dysproz Dysproz added the kind/bug Some behavior is incorrect or out of spec label Mar 11, 2022
@mikhailshilkov mikhailshilkov transferred this issue from pulumi/pulumi Mar 11, 2022
@viveklak
Copy link
Contributor

Any chance you have disabled default providers? https://www.pulumi.com/docs/intro/concepts/resources/providers/#disabling-default-providers - we have work in progress to fix that in #1912.

@Dysproz
Copy link
Author

Dysproz commented Mar 16, 2022

Not sure as I'm using automation API

    const pulumiProgram = async () => {
        return await createResource();
    }
    const args: InlineProgramArgs = {
      stackName: "stack",
      projectName: "project",
      program: pulumiProgram,
    };
    const stack = await LocalWorkspace.createOrSelectStack(args);
    console.info("successfully initialized stack");
    console.info("installing plugins...");
    await stack.workspace.installPlugin(cloud, "v4.0.0");
    await stack.workspace.installPlugin("eks", "v0.37.1");
    console.info("plugins installed");
    console.info("setting up config");
    await stack.setConfig(`${cloud}:region`, { value: regionConfig.region });
    console.info("config set");
    console.info("refreshing stack...");
    await stack.refresh({ onOutput: console.info });
    ...

I've noticed that I had to trigger installPlugin functions for aws and eks plugins.
Should I maybe trigger it for some other plugins?

@mnlumi mnlumi added the mro2 Monica's list of 2st tier overlay related issues label Mar 28, 2023
@EronWright EronWright self-assigned this Mar 29, 2024
@EronWright
Copy link
Contributor

EronWright commented Mar 29, 2024

I believe that this error message (A provider is required to deploy the chart) is produced by the chart template itself (e.g. using the fail function), since provider is one of the chart's input values. The chart version v1.2.0 seems quite old and I'm unable to find its exact source code (see Artifact Hub).

I'm closing this issue for now, please re-open if you're seeing it with a newer version of the chart and provider.

@EronWright EronWright closed this as not planned Won't fix, can't repro, duplicate, stale Mar 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/helm kind/bug Some behavior is incorrect or out of spec mro2 Monica's list of 2st tier overlay related issues
Projects
None yet
Development

No branches or pull requests

5 participants