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 chart duplicate URNs #616

Closed
timmyers opened this issue Jul 1, 2019 · 1 comment · Fixed by #625
Closed

Helm chart duplicate URNs #616

timmyers opened this issue Jul 1, 2019 · 1 comment · Fixed by #625
Assignees
Labels
kind/bug Some behavior is incorrect or out of spec
Milestone

Comments

@timmyers
Copy link

timmyers commented Jul 1, 2019

This is another issue around the problem of resulting in duplicate URN's with the usage of helm charts. Previous, similar issues include #489 and #520.

A resourcePrefix option was added to address this in #599, however this occurs even with that fix.

Some helm charts instantiate resources of type: APIService (or other similar types), which will require metadata.name to take on a specific format. An example value for an APIService resource might be v1beta1.metrics.k8s.io. These names are hard coded, and not interpolated based on the release name.

The resourcePrefix only affects the release name, and so does not prevent these resources from colliding if multiple are instantiated.

class K8SMetricsServer extends pulumi.ComponentResource {
  public constructor(name: string, settingsIgnored: { }, opts?: pulumi.ComponentResourceOptions) {
    super('infrastructure:k8s-metrics-server', name, { }, opts);

    const defaultOpts = { parent: this };

    const chartIgnored = new k8s.helm.v2.Chart(name, {
      repo: 'stable',
      chart: 'metrics-server',
      version: '2.8.2',
      resourcePrefix: name,
    }, defaultOpts);

    this.registerOutputs();
  }
}

export default async (): Promise<void> => {
    const metricsServer1 = new K8SMetricsServer("metrics1", {}, {});
    const metricsServer2 = new K8SMetricsServer("metrics2", {}, {});
};
pulumi preview

...

Diagnostics:
  pulumi:pulumi:Stack (infrastructure-clusters):
    (node:76310) ExperimentalWarning: queueMicrotask() is experimental.
 
  kubernetes:apiregistration:APIService (kube-system/v1beta1.metrics.k8s.io):
    error: Duplicate resource URN 'urn:pulumi:clusters::infrastructure::infrastructure:k8s-cluster-v2$infrastructure:k8s-metrics-server$kubernetes:helm.sh/v2:Chart$kubernetes:apiregistration/v1beta1:APIService::kube-system/v1beta1.metrics.k8s.io'; try giving it a unique name
@lukehoban lukehoban added the kind/bug Some behavior is incorrect or out of spec label Jul 1, 2019
@beetahnator
Copy link
Contributor

Just ran into this as well, seems that resourcePrefix is only being used for the component constructor.

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

Successfully merging a pull request may close this issue.

5 participants