Skip to content

Commit bb78342

Browse files
committed
[patch] add kyverno labels to create namespace
1 parent e2d22a8 commit bb78342

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

src/mas/devops/ocp.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ def getNamespace(dynClient: DynamicClient, namespace: str) -> dict:
9494
return {}
9595

9696

97-
def createNamespace(dynClient: DynamicClient, namespace: str) -> bool:
97+
def createNamespace(dynClient: DynamicClient, namespace: str, kyvernoLabels: bool = False) -> bool:
9898
"""
9999
Create a namespace if it does not exist
100100
"""
@@ -110,6 +110,10 @@ def createNamespace(dynClient: DynamicClient, namespace: str) -> bool:
110110
"name": namespace
111111
}
112112
}
113+
if kyvernoLabels is not None:
114+
nsObj["metadata"]["labels"] = {
115+
"ibm.com/kyverno": "audit"
116+
}
113117
namespaceAPI.create(body=nsObj)
114118
logger.debug(f"Created namespace {namespace}")
115119
return True

0 commit comments

Comments
 (0)