creamy-monkey-35142
05/26/2023, 10:37 AMdef 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
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?