HI there, please help. Currently, I’m trying to ve...
# general
c
HI there, please help. Currently, I’m trying to verify k8s namespace exist before create new ns with
Copy code
def check_namespace_not_exist(namespace):
    try:
        return Namespace.get("existing-namespace", namespace)
    except Exception:  # Exception raised when a namespace does not exist
        return None

existing_namespace = check_namespace_not_exist(namespace_name)

if existing_namespace is None:
    pulumi.export("namespace_not_exist", True)
else:
    pulumi.export("namespace_not_exist", False)
then it return message like image below , but when I add more logic into code
Copy code
if existing_namespace is None:
    pulumi.export("namespace_not_exist", True)
    print("Namespace not exist")
else:
    pulumi.export("namespace_not_exist", False)
    print("Namespace exist")
I noticed that
print()
is never triggered. so do you guys know how to check if a k8s’s namespace exist?