From b2c6b3a2acd46cef6b2bf2105eab6a3f204c15ba Mon Sep 17 00:00:00 2001 From: WangDian Date: Tue, 31 May 2022 16:18:39 +0800 Subject: [PATCH 1/5] Use cluster scale to control clusterPurpose and inferenceRouterHA --- .../partner_extensions/AzureMLKubernetes.py | 35 +++++++++---------- 1 file changed, 16 insertions(+), 19 deletions(-) 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 97fab3fd8aa..84b1b217a66 100644 --- a/src/k8s-extension/azext_k8s_extension/partner_extensions/AzureMLKubernetes.py +++ b/src/k8s-extension/azext_k8s_extension/partner_extensions/AzureMLKubernetes.py @@ -89,6 +89,7 @@ def __init__(self): self.inferenceRouterServiceType = 'inferenceRouterServiceType' self.internalLoadBalancerProvider = 'internalLoadBalancerProvider' self.inferenceRouterHA = 'inferenceRouterHA' + self.clusterPurpose = 'clusterPurpose' # constants for existing AKS to AMLARC migration self.IS_AKS_MIGRATION = 'isAKSMigration' @@ -133,15 +134,28 @@ def Create(self, cmd, client, resource_group_name, cluster_name, name, cluster_t cluster_resource_id, parent_api_version) cluster_location = resource.location.lower() try: + isSmallScale = False if cluster_type.lower() == 'connectedclusters': if resource.properties['totalNodeCount'] < 3: - configuration_settings['clusterPurpose'] = 'DevTest' + isSmallScale = True if cluster_type.lower() == 'managedclusters': nodeCount = 0 for agent in resource.properties['agentPoolProfiles']: nodeCount += agent['count'] if nodeCount < 3: - configuration_settings['clusterPurpose'] = 'DevTest' + isSmallScale = True + + if isSmallScale: + clusterPurpose = _get_value_from_config_protected_config( + self.clusterPurpose, configuration_settings, configuration_protected_settings) + if clusterPurpose is None: + configuration_settings[self.clusterPurpose] = 'DevTest' + + inferenceRouterHA = _get_value_from_config_protected_config( + self.inferenceRouterHA, configuration_settings, configuration_protected_settings) + if inferenceRouterHA is None: + configuration_settings[self.inferenceRouterHA] = 'false' + if resource.properties.get('distribution', '').lower() == self.OPEN_SHIFT: configuration_settings[self.OPEN_SHIFT] = 'true' except: @@ -366,16 +380,6 @@ def Update(self, cmd, resource_group_name, cluster_name, auto_upgrade_minor_vers configuration_protected_settings=configuration_protected_settings) def __normalize_config(self, configuration_settings, configuration_protected_settings): - # inference - inferenceRouterHA = _get_value_from_config_protected_config( - self.inferenceRouterHA, configuration_settings, configuration_protected_settings) - if inferenceRouterHA is not None: - isTestCluster = str(inferenceRouterHA).lower() == 'false' - if isTestCluster: - configuration_settings['clusterPurpose'] = 'DevTest' - else: - configuration_settings['clusterPurpose'] = 'FastProd' - inferenceRouterServiceType = _get_value_from_config_protected_config( self.inferenceRouterServiceType, configuration_settings, configuration_protected_settings) if inferenceRouterServiceType: @@ -432,13 +436,6 @@ def __validate_config(self, configuration_settings, configuration_protected_sett configuration_protected_settings.pop(self.ENABLE_INFERENCE, None) def __validate_scoring_fe_settings(self, configuration_settings, configuration_protected_settings, release_namespace): - inferenceRouterHA = _get_value_from_config_protected_config( - self.inferenceRouterHA, configuration_settings, configuration_protected_settings) - isTestCluster = True if inferenceRouterHA is not None and str(inferenceRouterHA).lower() == 'false' else False - if isTestCluster: - configuration_settings['clusterPurpose'] = 'DevTest' - else: - configuration_settings['clusterPurpose'] = 'FastProd' isAKSMigration = _get_value_from_config_protected_config( self.IS_AKS_MIGRATION, configuration_settings, configuration_protected_settings) isAKSMigration = str(isAKSMigration).lower() == 'true' From dc14eb66bcb0606cf4501442166975cbe56f2435 Mon Sep 17 00:00:00 2001 From: WangDian Date: Wed, 1 Jun 2022 15:20:58 +0800 Subject: [PATCH 2/5] Update AzureMLKubernetes.py To solve transient gate error --- .../partner_extensions/AzureMLKubernetes.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) 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 84b1b217a66..8570efd2f6f 100644 --- a/src/k8s-extension/azext_k8s_extension/partner_extensions/AzureMLKubernetes.py +++ b/src/k8s-extension/azext_k8s_extension/partner_extensions/AzureMLKubernetes.py @@ -134,18 +134,18 @@ def Create(self, cmd, client, resource_group_name, cluster_name, name, cluster_t cluster_resource_id, parent_api_version) cluster_location = resource.location.lower() try: - isSmallScale = False + isDevScale = False if cluster_type.lower() == 'connectedclusters': if resource.properties['totalNodeCount'] < 3: - isSmallScale = True + isDevScale = True if cluster_type.lower() == 'managedclusters': nodeCount = 0 for agent in resource.properties['agentPoolProfiles']: nodeCount += agent['count'] if nodeCount < 3: - isSmallScale = True + isDevScale = True - if isSmallScale: + if isDevScale: clusterPurpose = _get_value_from_config_protected_config( self.clusterPurpose, configuration_settings, configuration_protected_settings) if clusterPurpose is None: From 4547f7b2bcbec6ad81c979a2a0847f769910a049 Mon Sep 17 00:00:00 2001 From: WangDian Date: Wed, 1 Jun 2022 15:57:51 +0800 Subject: [PATCH 3/5] Update AzureMLKubernetes.py --- .../partner_extensions/AzureMLKubernetes.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) 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 8570efd2f6f..84b1b217a66 100644 --- a/src/k8s-extension/azext_k8s_extension/partner_extensions/AzureMLKubernetes.py +++ b/src/k8s-extension/azext_k8s_extension/partner_extensions/AzureMLKubernetes.py @@ -134,18 +134,18 @@ def Create(self, cmd, client, resource_group_name, cluster_name, name, cluster_t cluster_resource_id, parent_api_version) cluster_location = resource.location.lower() try: - isDevScale = False + isSmallScale = False if cluster_type.lower() == 'connectedclusters': if resource.properties['totalNodeCount'] < 3: - isDevScale = True + isSmallScale = True if cluster_type.lower() == 'managedclusters': nodeCount = 0 for agent in resource.properties['agentPoolProfiles']: nodeCount += agent['count'] if nodeCount < 3: - isDevScale = True + isSmallScale = True - if isDevScale: + if isSmallScale: clusterPurpose = _get_value_from_config_protected_config( self.clusterPurpose, configuration_settings, configuration_protected_settings) if clusterPurpose is None: From c8378c4b1978eb93f216b781195b4076cecee472 Mon Sep 17 00:00:00 2001 From: WangDian Date: Wed, 1 Jun 2022 16:50:00 +0800 Subject: [PATCH 4/5] Update AzureMLKubernetes.py --- .../partner_extensions/AzureMLKubernetes.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) 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 84b1b217a66..8570efd2f6f 100644 --- a/src/k8s-extension/azext_k8s_extension/partner_extensions/AzureMLKubernetes.py +++ b/src/k8s-extension/azext_k8s_extension/partner_extensions/AzureMLKubernetes.py @@ -134,18 +134,18 @@ def Create(self, cmd, client, resource_group_name, cluster_name, name, cluster_t cluster_resource_id, parent_api_version) cluster_location = resource.location.lower() try: - isSmallScale = False + isDevScale = False if cluster_type.lower() == 'connectedclusters': if resource.properties['totalNodeCount'] < 3: - isSmallScale = True + isDevScale = True if cluster_type.lower() == 'managedclusters': nodeCount = 0 for agent in resource.properties['agentPoolProfiles']: nodeCount += agent['count'] if nodeCount < 3: - isSmallScale = True + isDevScale = True - if isSmallScale: + if isDevScale: clusterPurpose = _get_value_from_config_protected_config( self.clusterPurpose, configuration_settings, configuration_protected_settings) if clusterPurpose is None: From 6593238efa261cd5b683fdb002f28459545f313e Mon Sep 17 00:00:00 2001 From: WangDian Date: Thu, 2 Jun 2022 10:28:38 +0800 Subject: [PATCH 5/5] Update AzureMLKubernetes.py --- .../partner_extensions/AzureMLKubernetes.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) 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 8570efd2f6f..84b1b217a66 100644 --- a/src/k8s-extension/azext_k8s_extension/partner_extensions/AzureMLKubernetes.py +++ b/src/k8s-extension/azext_k8s_extension/partner_extensions/AzureMLKubernetes.py @@ -134,18 +134,18 @@ def Create(self, cmd, client, resource_group_name, cluster_name, name, cluster_t cluster_resource_id, parent_api_version) cluster_location = resource.location.lower() try: - isDevScale = False + isSmallScale = False if cluster_type.lower() == 'connectedclusters': if resource.properties['totalNodeCount'] < 3: - isDevScale = True + isSmallScale = True if cluster_type.lower() == 'managedclusters': nodeCount = 0 for agent in resource.properties['agentPoolProfiles']: nodeCount += agent['count'] if nodeCount < 3: - isDevScale = True + isSmallScale = True - if isDevScale: + if isSmallScale: clusterPurpose = _get_value_from_config_protected_config( self.clusterPurpose, configuration_settings, configuration_protected_settings) if clusterPurpose is None: