Hello all.. I am getting started with Pulumi for ...
# getting-started
Hello all.. I am getting started with Pulumi for Kubernetes platform (python): I am trying to create a namespace in my automation program:
Copy code
ns = Namespace(kwargs["namespace"], metadata={"name": kwargs["namespace"]})
This works when the namespace does not exist. It fails with “already exists” if the namespace exists.
Copy code
+  pulumi:pulumi:Stack pulumi-iac-k8-deploy-heml-rmjbpcxuer creating
 +  kubernetes:core/v1:Namespace iac-test creating
 +  kubernetes:core/v1:Namespace iac-test creating Retry #0; creation failed: namespaces "iac-test" already exists
How do I change this code so that Namespace is created only if it doesn’t exist. ? I am looking at the docs but cannot find an option to do this.. Help appreciated..
any insight into this?
If you've previously created the namespace outside of Pulumi, you should import it into Pulumi