Hey all, I am having issues creating a namespace a...
# general
l
Hey all, I am having issues creating a namespace and referencing that namespace name while using the kubernetes.core.v1.Namespace (kubernetes provider). The namespace name I want is
istio-system
, but a randomly generated string gets appended to the name. Is there a way to specify a specific name for a namespace when using
new kubernetes.core.v1.Namespace
?
Copy code
const istioNamespaceName = "istio-system"

const istioNamespace = new k8s.core.v1.Namespace(istioNamespaceName);

const istioVersion = "1.15.0";

const istioBase = new k8s.helm.v3.Chart("istio-base", {
    chart: "base",
    version: istioVersion,
    namespace: istioNamespaceName,
    fetchOpts: {
        repo: "<https://istio-release.storage.googleapis.com/charts>",
    },
}, {
    dependsOn: istioNamespace
});
b
Copy code
const istioNamespace = new k8s.core.v1.Namespace(istioNamespaceName, {
  metadata: {
    name: "istio-system
  }
});
you need to explicitly define the namespace name
then
Copy code
const istioBase = new k8s.helm.v3.Chart("istio-base", {
    chart: "base",
    version: istioVersion,
    namespace: istioNamespace.metadata.name,
    fetchOpts: {
        repo: "<https://istio-release.storage.googleapis.com/charts>",
    },
}, {
    dependsOn: istioNamespace
});
To reference it
l
Thank you @billowy-army-68599! This is exactly what I was looking for, but couldn't find it in the docs!
s
in general, if any resource has a property that lets you assign it a name and it's left blank, pulumi will generate the name based on the pulumi resource name appended with some random characters.
🙌 1