From d76b9cefe961b41b1a89e2e4980842d8a0c65af9 Mon Sep 17 00:00:00 2001 From: Jonathan Innis Date: Fri, 6 May 2022 23:10:23 -0700 Subject: [PATCH] [k8s-extension] Update extension CLI to v1.2.1 (#4773) --- src/k8s-extension/HISTORY.rst | 5 +++++ src/k8s-extension/azext_k8s_extension/custom.py | 12 +++++++----- .../partner_extensions/AzureMLKubernetes.py | 15 +++++++++++---- .../v2022_03_01/models/_models_py3.py | 4 ++-- src/k8s-extension/setup.py | 2 +- 5 files changed, 26 insertions(+), 12 deletions(-) diff --git a/src/k8s-extension/HISTORY.rst b/src/k8s-extension/HISTORY.rst index 6934bf610c9..42ad54552ac 100644 --- a/src/k8s-extension/HISTORY.rst +++ b/src/k8s-extension/HISTORY.rst @@ -3,6 +3,11 @@ Release History =============== +1.2.1 +++++++++++++++++++ +* Provide no default values for Patch of Extension +* microsoft.azureml.kubernetes: clusterip + 1.2.0 ++++++++++++++++++ * microsoft.azureml.kubernetes: Update AzureMLKubernetes install parameters on inferenceRouterServiceType and internalLoadBalancerProvider diff --git a/src/k8s-extension/azext_k8s_extension/custom.py b/src/k8s-extension/azext_k8s_extension/custom.py index abff15a0246..49e392ddbae 100644 --- a/src/k8s-extension/azext_k8s_extension/custom.py +++ b/src/k8s-extension/azext_k8s_extension/custom.py @@ -226,9 +226,9 @@ def update_k8s_extension( cluster_name, name, cluster_type, - auto_upgrade_minor_version="", - release_train="", - version="", + auto_upgrade_minor_version=None, + release_train=None, + version=None, configuration_settings=None, configuration_protected_settings=None, configuration_settings_file=None, @@ -261,13 +261,14 @@ def update_k8s_extension( ) extension_type_lower = extension.extension_type.lower() - config_settings = {} - config_protected_settings = {} + config_settings = None + config_protected_settings = None # Get Configuration Settings from file if configuration_settings_file is not None: config_settings = read_config_settings_file(configuration_settings_file) if configuration_settings is not None: + config_settings = {} for dicts in configuration_settings: for key, value in dicts.items(): config_settings[key] = value @@ -279,6 +280,7 @@ def update_k8s_extension( ) if configuration_protected_settings is not None: + config_protected_settings = {} for dicts in configuration_protected_settings: for key, value in dicts.items(): config_protected_settings[key] = value diff --git a/src/k8s-extension/azext_k8s_extension/partner_extensions/AzureMLKubernetes.py b/src/k8s-extension/azext_k8s_extension/partner_extensions/AzureMLKubernetes.py index 34eb3218de2..f985bec7541 100644 --- a/src/k8s-extension/azext_k8s_extension/partner_extensions/AzureMLKubernetes.py +++ b/src/k8s-extension/azext_k8s_extension/partner_extensions/AzureMLKubernetes.py @@ -334,9 +334,9 @@ def __normalize_config(self, configuration_settings, configuration_protected_set inferenceRouterServiceType = _get_value_from_config_protected_config( self.inferenceRouterServiceType, configuration_settings, configuration_protected_settings) if inferenceRouterServiceType: - if inferenceRouterServiceType.lower() != 'nodeport' and inferenceRouterServiceType.lower() != 'loadbalancer': + if not _is_valid_service_type(inferenceRouterServiceType): raise InvalidArgumentValueError( - "inferenceRouterServiceType only supports nodePort or loadBalancer." + "inferenceRouterServiceType only supports NodePort or LoadBalancer or ClusterIP." "Check https://aka.ms/arcmltsg for more information.") feIsNodePort = str(inferenceRouterServiceType).lower() == 'nodeport' @@ -424,10 +424,10 @@ def __validate_scoring_fe_settings(self, configuration_settings, configuration_p inferenceRouterServiceType = _get_value_from_config_protected_config( self.inferenceRouterServiceType, configuration_settings, configuration_protected_settings) - if not inferenceRouterServiceType or (inferenceRouterServiceType.lower() != 'nodeport' and inferenceRouterServiceType.lower() != 'loadbalancer'): + if not _is_valid_service_type(inferenceRouterServiceType): raise InvalidArgumentValueError( "To use inference, " - "please specify inferenceRouterServiceType=nodePort or inferenceRouterServiceType=loadBalancer in --configuration-settings and also set internalLoadBalancerProvider=azure if your aks only supports internal load balancer." + "please specify inferenceRouterServiceType=ClusterIP or inferenceRouterServiceType=NodePort or inferenceRouterServiceType=LoadBalancer in --configuration-settings and also set internalLoadBalancerProvider=azure if your aks only supports internal load balancer." "Check https://aka.ms/arcmltsg for more information.") feIsNodePort = str(inferenceRouterServiceType).lower() == 'nodeport' @@ -690,3 +690,10 @@ def _check_nodeselector_existed(configuration_settings, configuration_protected_ if "nodeSelector" in key: return True return False + + +def _is_valid_service_type(service_type): + if service_type: + return service_type.lower() == 'nodeport' or service_type.lower() == 'loadbalancer' or service_type.lower() == 'clusterip' + else: + return False diff --git a/src/k8s-extension/azext_k8s_extension/vendored_sdks/v2022_03_01/models/_models_py3.py b/src/k8s-extension/azext_k8s_extension/vendored_sdks/v2022_03_01/models/_models_py3.py index 0519413294b..d3ddc1536de 100644 --- a/src/k8s-extension/azext_k8s_extension/vendored_sdks/v2022_03_01/models/_models_py3.py +++ b/src/k8s-extension/azext_k8s_extension/vendored_sdks/v2022_03_01/models/_models_py3.py @@ -1714,8 +1714,8 @@ class PatchExtension(msrest.serialization.Model): def __init__( self, *, - auto_upgrade_minor_version: Optional[bool] = True, - release_train: Optional[str] = "Stable", + auto_upgrade_minor_version: Optional[bool] = None, + release_train: Optional[str] = None, version: Optional[str] = None, configuration_settings: Optional[Dict[str, str]] = None, configuration_protected_settings: Optional[Dict[str, str]] = None, diff --git a/src/k8s-extension/setup.py b/src/k8s-extension/setup.py index 24c14f3cc99..d9814e8c781 100644 --- a/src/k8s-extension/setup.py +++ b/src/k8s-extension/setup.py @@ -33,7 +33,7 @@ # TODO: Add any additional SDK dependencies here DEPENDENCIES = [] -VERSION = "1.2.0" +VERSION = "1.2.1" with open("README.rst", "r", encoding="utf-8") as f: README = f.read()