I am creating a namespace in kubernetes and its no...
# general
n
I am creating a namespace in kubernetes and its not taking the name parameter and the random namespace name is not working for deploying openfaas. and its creating namespace named
openfaas-fn-969d4df0
which is not working This is error and code :
Argument of type '{ name: string; }' is not assignable to parameter of type 'NamespaceArgs'.
Object literal may only specify known properties, and 'name' does not exist in type 'NamespaceArgs'.
Copy code
const openfaasNamespace = new k8s.core.v1.Namespace("openfaas-fn", {
  // name: "openfaas-fn", it is not taking this parameter
}, { provider: k8sProvider });

openfaasNamespace.id.apply((id) => {
const openFaasChart = new k8s.helm.v3.Chart("openfaas", {
    fetchOpts: { repo: "<https://openfaas.github.io/faas-netes/>" },
    chart: "openfaas",
  // namespace: "openfaas-fn-969d4df0",
    namespace: openfaasNamespace.metadata.name,
    values: {
        gateway: {
            resources: {
                requests: {
                    memory: "64Mi",
                    cpu: "100m"
                },
                limits: {
                    memory: "128Mi",
                    cpu: "300m"
                },
            },
        },
        controller: {
            admissionWebhooks: {
                enabled: false,
            },
        },
    },
}, { provider: k8sProvider,
   dependsOn: openfaasNamespace
 });
})

export const resourceGrp = openfaasNamespace.metadata.name;
b
Name is set on the metadata, so:
Copy code
const openfaasNamespace = new k8s.core.v1.Namespace("openfaas-fn", {
  metadata: {
      name: "openfaas-fn"
   }
}, { provider: k8sProvider });
n
Thanks a lot for helping me. I just installed openfaas for lambda function in digitalocean using pulumi. Also its not mentioned to use metadata for name in pulumi docs.
s
names in metadata are a k8s thing, not pulumi per se https://www.pulumi.com/docs/concepts/resources/names/
n
@straight-cartoon-24485 I read this docs and I was following this https://www.pulumi.com/registry/packages/kubernetes/api-docs/core/v1/namespace/#objectmeta but its taking name directly
s
? kinda what I was thinking, they refer you to k8s docs
n
@straight-cartoon-24485 yes, I am able to pass the namespace value using metadata.name, but also for name without suffix, I have to use the same, which is missing in the docs. Should I create an issue for it, if I am right ?
s
can't hurt 🙂, you're right that's an important detail when they must match
n
Thanks, I will raise an issue in the docs now.