Skip to content

Commit

Permalink
Add cluster name truncation for Kubernetes (#3640)
Browse files Browse the repository at this point in the history
  • Loading branch information
romilbhardwaj authored Jun 5, 2024
1 parent 7a6df2f commit 15905e8
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions sky/clouds/kubernetes.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,13 @@ class Kubernetes(clouds.Cloud):
timeout = skypilot_config.get_nested(['kubernetes', 'provision_timeout'],
10)

# Limit the length of the cluster name to avoid exceeding the limit of 63
# characters for Kubernetes resources. We limit to 42 characters (63-21) to
# allow additional characters for creating ingress services to expose ports.
# These services are named as {cluster_name_on_cloud}--skypilot-svc--{port},
# where the suffix is 21 characters long.
_MAX_CLUSTER_NAME_LEN_LIMIT = 42

_SUPPORTS_SERVICE_ACCOUNT_ON_REMOTE = True

_DEFAULT_NUM_VCPUS = 2
Expand Down Expand Up @@ -104,6 +111,10 @@ def _unsupported_features_for_resources(
clouds.CloudImplementationFeatures.AUTO_TERMINATE] = message
return unsupported_features

@classmethod
def max_cluster_name_length(cls) -> Optional[int]:
return cls._MAX_CLUSTER_NAME_LEN_LIMIT

@classmethod
def regions(cls) -> List[clouds.Region]:
return cls._regions
Expand Down

0 comments on commit 15905e8

Please sign in to comment.