https://pulumi.com logo
#general
Title
# general
p

polite-beard-77602

03/04/2019, 5:21 PM
hello, having some issues with creating a stack in kubernetes with a helm chart stable/prometheus-operator. It is giving me a duplicate resource URN error, I have manually searched for a duplicate on the cluster (doesn’t exist), tried a different namespace, tried a different stack name. Looking for some guidance where to look
Copy code
Diagnostics:
  kubernetes:<http://rbac.authorization.k8s.io:Role|rbac.authorization.k8s.io:Role> (default/prometheus-operator-prometheus):
    error: Duplicate resource URN 'urn:pulumi:prometheus-monitoring-test::eks-devops-metrics-server::kubernetes:<http://helm.sh/v2:Chart$kubernetes:rbac.authorization.k8s.io/v1:Role::default/prometheus-operator-prometheus';|helm.sh/v2:Chart$kubernetes:rbac.authorization.k8s.io/v1:Role::default/prometheus-operator-prometheus';> try giving it a unique name
c

creamy-potato-29402

03/04/2019, 5:37 PM
we've heard this before. can you share the exact call to helm.v2.chart
in previous instances of this problem it has been the case that the chart has generated two of the same crd. that issue should have been fixed though
p

polite-beard-77602

03/04/2019, 5:46 PM
this is my index.ts:
Copy code
import * as k8s from "@pulumi/kubernetes";
import * as config from './config';

function addNamespace(o: any) {
    if (o !== undefined) {
        o.metadata = Object.assign(o.metadata || {}, {namespace});
    }
}

const namespace = config.namespace;

if (namespace !== 'default') {
    new k8s.core.v1.Namespace("testrandom0x112", {
        metadata: {
            name: namespace
        }
    }, {
        provider: config.k8sProvider
    });
}

const prometheus_operator2 = new k8s.helm.v2.Chart(
    "prometheus-operator2", 
    {
        repo: "stable",
        chart: "prometheus-operator",
        version: "4.2.1",
        namespace,
        values: {
            replicaCount: 1
        },
        transformations: [addNamespace]
    },
    { providers: { kubernetes: config.k8sProvider } },
);
c

creamy-potato-29402

03/04/2019, 5:59 PM
cc @gorgeous-egg-16927 I'm not back until 1 or so
p

polite-beard-77602

03/04/2019, 6:37 PM
my colleague looked deeper, added more conditions to the addNamespace function in index.ts to get around this issue
g

gorgeous-egg-16927

03/04/2019, 9:27 PM
I believe this is another instance of https://github.com/pulumi/pulumi-kubernetes/issues/456
3 Views