Skip to content

Commit

Permalink
Don't require create namespace permission in cluster launch flow (#3714)
Browse files Browse the repository at this point in the history
  • Loading branch information
colinjc authored Jul 2, 2024
1 parent 47d3dc0 commit ad5966d
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions sky/provision/kubernetes/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -1529,6 +1529,14 @@ def create_namespace(namespace: str) -> None:
namespace: Name of the namespace to create
"""
kubernetes_client = kubernetes.kubernetes.client
try:
kubernetes.core_api().read_namespace(namespace)
except kubernetes.api_exception() as e:
if e.status != 404:
raise
else:
return

ns_metadata = dict(name=namespace, labels={'parent': 'skypilot'})
merge_custom_metadata(ns_metadata)
namespace_obj = kubernetes_client.V1Namespace(metadata=ns_metadata)
Expand Down

0 comments on commit ad5966d

Please sign in to comment.