Skip to content

Commit 627c7d9

Browse files
committed
k8s: ignore internal namespaces
1 parent 6a48a64 commit 627c7d9

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/warnet/k8s.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
CADDY_INGRESS_NAME,
1919
DEFAULT_NAMESPACE,
2020
INGRESS_NAMESPACE,
21+
KUBE_INTERNAL_NAMESPACES,
2122
KUBECONFIG,
2223
LOGGING_NAMESPACE,
2324
)
@@ -370,7 +371,11 @@ def get_kubeconfig_value(jsonpath):
370371
def get_namespaces() -> list[V1Namespace]:
371372
sclient = get_static_client()
372373
try:
373-
return sclient.list_namespace().items
374+
return [
375+
ns
376+
for ns in sclient.list_namespace().items
377+
if ns.metadata.name not in KUBE_INTERNAL_NAMESPACES
378+
]
374379

375380
except ApiException as e:
376381
if e.status == 403:

0 commit comments

Comments
 (0)