diff --git a/sky/clouds/kubernetes.py b/sky/clouds/kubernetes.py index 3262127abb2..ae15fe1a8f5 100644 --- a/sky/clouds/kubernetes.py +++ b/sky/clouds/kubernetes.py @@ -9,6 +9,7 @@ from sky import sky_logging from sky import status_lib from sky.adaptors import kubernetes +from sky.clouds import service_catalog from sky.utils import common_utils from sky.utils import kubernetes_utils from sky.utils import ux_utils @@ -66,10 +67,8 @@ class Kubernetes(clouds.Cloud): ('Docker image is not supported in Kubernetes. ') } - IMAGE_CPU = ('us-central1-docker.pkg.dev/' - 'skypilot-375900/skypilotk8s/skypilot:latest') - IMAGE_GPU = ('us-central1-docker.pkg.dev/skypilot-375900/' - 'skypilotk8s/skypilot-gpu:latest') + IMAGE_CPU = 'skypilot:cpu-ubuntu-2004' + IMAGE_GPU = 'skypilot:gpu-ubuntu-2004' @classmethod def _cloud_unsupported_features( @@ -202,7 +201,14 @@ def make_deploy_resources_variables( acc_type = k.accelerator_type if k.accelerator_type else None # Select image based on whether we are using GPUs or not. - image = self.IMAGE_GPU if acc_count > 0 else self.IMAGE_CPU + image_id = self.IMAGE_GPU if acc_count > 0 else self.IMAGE_CPU + # Get the container image ID from the service catalog. + # TODO(romilb): Note that currently we do not support custom images, + # so the image_id should start with 'skypilot:'. + # In the future we may want to get image_id from the resources object. + assert image_id.startswith('skypilot:') + image_id = service_catalog.get_image_id_from_tag(image_id, + clouds='kubernetes') k8s_acc_label_key = None k8s_acc_label_value = None @@ -224,7 +230,7 @@ def make_deploy_resources_variables( 'k8s_acc_label_key': k8s_acc_label_key, 'k8s_acc_label_value': k8s_acc_label_value, # TODO(romilb): Allow user to specify custom images - 'image_id': image, + 'image_id': image_id, } return deploy_vars diff --git a/sky/clouds/service_catalog/README.md b/sky/clouds/service_catalog/README.md index 58f554324b2..da74229e6bc 100644 --- a/sky/clouds/service_catalog/README.md +++ b/sky/clouds/service_catalog/README.md @@ -1,8 +1,6 @@ # Service Catalog -We support 3 major clouds: AWS, Azure and GCP. - -This module provides information including the instance type offerings, their pricing and data transfer costs. It also provides functions to query these information, and to select the most suitable instance types based on resource requirements. Primarily used by the Clouds module. +This module provides information for clouds supported by SkyPilot, including the instance type offerings, their pricing and data transfer costs. It also provides functions to query these information, and to select the most suitable instance types based on resource requirements. Primarily used by the Clouds module. - `data_fetchers/fetch_{aws,azure}.py`: each file is a standalone script that queries the cloud APIs to produce the pricing list files. - `data_fetchers/fetch_gcp.py`: A script that generates the GCP catalog based by crawling GCP websites. diff --git a/sky/clouds/service_catalog/kubernetes_catalog.py b/sky/clouds/service_catalog/kubernetes_catalog.py new file mode 100644 index 00000000000..86033dab94e --- /dev/null +++ b/sky/clouds/service_catalog/kubernetes_catalog.py @@ -0,0 +1,28 @@ +"""Kubernetes Catalog. + +Kubernetes does not require a catalog of instances, but we need an image catalog +mapping SkyPilot image tags to corresponding container image tags. +""" + +from typing import Optional + +from sky.clouds.service_catalog import common + +_PULL_FREQUENCY_HOURS = 7 + +# We keep pull_frequency_hours so we can remotely update the default image paths +_image_df = common.read_catalog('kubernetes/images.csv', + pull_frequency_hours=_PULL_FREQUENCY_HOURS) + +# TODO(romilb): Refactor implementation of common service catalog functions from +# clouds/kubernetes.py to kubernetes_catalog.py + + +def get_image_id_from_tag(tag: str, region: Optional[str]) -> Optional[str]: + """Returns the image id from the tag.""" + return common.get_image_id_from_tag_impl(_image_df, tag, region) + + +def is_image_tag_valid(tag: str, region: Optional[str]) -> bool: + """Returns whether the image tag is valid.""" + return common.is_image_tag_valid_impl(_image_df, tag, region)