diff --git a/sky/backends/backend_utils.py b/sky/backends/backend_utils.py index 95c2296b0b9..62d965e3b79 100644 --- a/sky/backends/backend_utils.py +++ b/sky/backends/backend_utils.py @@ -916,7 +916,8 @@ def write_cluster_config( tmp_yaml_path, cluster_config_overrides=to_provision.cluster_config_overrides) kubernetes_utils.combine_metadata_fields(tmp_yaml_path) - valid, message = kubernetes_utils.check_pod_config(tmp_yaml_path) + valid, message = kubernetes_utils.check_pod_config( + tmp_yaml_path, dryrun) if not valid: raise exceptions.InvalidCloudConfigs( f'There are invalid config in pod_config, deatil: {message}') diff --git a/sky/provision/kubernetes/utils.py b/sky/provision/kubernetes/utils.py index 495147d3caf..8cd46cf7323 100644 --- a/sky/provision/kubernetes/utils.py +++ b/sky/provision/kubernetes/utils.py @@ -892,7 +892,8 @@ def check_credentials(context: Optional[str], return True, None -def check_pod_config(cluster_yaml_path: str) -> Tuple[bool, Optional[str]]: +def check_pod_config(cluster_yaml_path: str, dryrun: bool) \ + -> Tuple[bool, Optional[str]]: """Check if the pod_config is a valid pod config Using create_namespaced_pod api with dry_run to check the pod_config @@ -926,6 +927,11 @@ def check_pod_config(cluster_yaml_path: str) -> Tuple[bool, Optional[str]]: error_msg = str(e) return False, error_msg except ValueError as e: + if dryrun: + logger.debug('ignore ValueError as there is no kube config ' + 'in the enviroment with dry_run. ' + 'For now we don\'t support check pod_config offline.') + return True, None return False, common_utils.format_exception(e) except Exception as e: # pylint: disable=broad-except return False, ('An error occurred: '