Skip to content
This repository was archived by the owner on May 13, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/k8s-extension/HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ Release History
1.1.0
++++++++++++++++++
* Migrate Extensions api-version to 2022-03-01
* microsoft.azureml.kubernetes: Remove inference private review warning message
* microsoft.azureml.kubernetes: Remove inference private review warning message, disable service bus by default
* microsoft.openservicemesh: Enable System-assigned identity

1.0.4
Expand Down
1 change: 1 addition & 0 deletions src/k8s-extension/azext_k8s_extension/custom.py
Original file line number Diff line number Diff line change
Expand Up @@ -297,6 +297,7 @@ def update_k8s_extension(
version,
config_settings,
config_protected_settings,
extension,
yes,
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ def __init__(self):
self.AZURE_LOG_ANALYTICS_CONNECTION_STRING = 'azure_log_analytics.connection_string'
self.JOB_SCHEDULER_LOCATION_KEY = 'jobSchedulerLocation'
self.CLUSTER_NAME_FRIENDLY_KEY = 'cluster_name_friendly'
self.NGINX_INGRESS_ENABLED_KEY = 'nginxIngress.enabled'

# component flag
self.ENABLE_TRAINING = 'enableTraining'
Expand All @@ -66,6 +67,10 @@ def __init__(self):
self.RELAY_SERVER_CONNECTION_STRING = 'relayServerConnectionString' # create relay connection string if None
self.SERVICE_BUS_CONNECTION_STRING = 'serviceBusConnectionString' # create service bus if None
self.LOG_ANALYTICS_WS_ENABLED = 'logAnalyticsWS' # create log analytics workspace if true
# default to false when creating the extension
self.SERVICE_BUS_ENABLED = 'servicebus.enabled'
# default to false if cluster is AKS when creating the extension
self.RELAY_SERVER_ENABLED = 'relayserver.enabled'

# constants for azure resources creation
self.RELAY_HC_AUTH_NAME = 'azureml_rw'
Expand Down Expand Up @@ -107,8 +112,8 @@ def Create(self, cmd, client, resource_group_name, cluster_name, name, cluster_t
if scope == 'namespace':
raise InvalidArgumentValueError("Invalid scope '{}'. This extension can't be installed "
"only at 'cluster' scope.".format(scope))
if not release_namespace:
release_namespace = self.DEFAULT_RELEASE_NAMESPACE
# set release name explicitly to azureml
release_namespace = self.DEFAULT_RELEASE_NAMESPACE
scope_cluster = ScopeCluster(release_namespace=release_namespace)
ext_scope = Scope(cluster=scope_cluster, namespace=None)

Expand Down Expand Up @@ -136,6 +141,8 @@ def Create(self, cmd, client, resource_group_name, cluster_name, name, cluster_t
nodeCount += agent['count']
if nodeCount < 3:
configuration_settings['clusterPurpose'] = 'DevTest'
if resource.properties.get('distribution', '').lower() == self.OPEN_SHIFT:
configuration_settings[self.OPEN_SHIFT] = 'true'
except:
pass
except CloudError as ex:
Expand All @@ -150,6 +157,20 @@ def Create(self, cmd, client, resource_group_name, cluster_name, name, cluster_t
self.JOB_SCHEDULER_LOCATION_KEY, cluster_location)
configuration_settings[self.CLUSTER_NAME_FRIENDLY_KEY] = configuration_settings.get(
self.CLUSTER_NAME_FRIENDLY_KEY, cluster_name)
# do not enable service bus by default
configuration_settings[self.SERVICE_BUS_ENABLED] = configuration_settings.get(self.SERVICE_BUS_ENABLED, 'false')

# do not enable relay for managed cluster(AKS) by default, do not enable nginx for ARC by default
if cluster_type == "managedClusters":
configuration_settings[self.RELAY_SERVER_ENABLED] = configuration_settings.get(self.RELAY_SERVER_ENABLED,
'false')
configuration_settings[self.NGINX_INGRESS_ENABLED_KEY] = configuration_settings.get(
self.NGINX_INGRESS_ENABLED_KEY, 'true')
else:
configuration_settings[self.RELAY_SERVER_ENABLED] = configuration_settings.get(self.RELAY_SERVER_ENABLED,
'true')
configuration_settings[self.NGINX_INGRESS_ENABLED_KEY] = configuration_settings.get(
self.NGINX_INGRESS_ENABLED_KEY, 'false')

# create Azure resources need by the extension based on the config.
self.__create_required_resource(
Expand Down Expand Up @@ -186,7 +207,7 @@ def Delete(self, cmd, client, resource_group_name, cluster_name, name, cluster_t
user_confirmation_factory(cmd, yes)

def Update(self, cmd, resource_group_name, cluster_name, auto_upgrade_minor_version, release_train, version, configuration_settings,
configuration_protected_settings, yes=False):
configuration_protected_settings, original_extension, yes=False):
self.__normalize_config(configuration_settings, configuration_protected_settings)

# Prompt message to ask customer to confirm again
Expand Down Expand Up @@ -281,7 +302,8 @@ def Update(self, cmd, resource_group_name, cluster_name, auto_upgrade_minor_vers
except azure.core.exceptions.HttpResponseError:
logger.info("Failed to get log analytics connection string.")

if self.RELAY_SERVER_CONNECTION_STRING not in configuration_protected_settings:
if original_extension.configuration_settings.get(self.RELAY_SERVER_ENABLED).lower() != 'false' \
and self.RELAY_SERVER_CONNECTION_STRING not in configuration_protected_settings:
try:
relay_connection_string, _, _ = _get_relay_connection_str(
cmd, subscription_id, resource_group_name, cluster_name, '', self.RELAY_HC_AUTH_NAME, True)
Expand All @@ -292,7 +314,8 @@ def Update(self, cmd, resource_group_name, cluster_name, auto_upgrade_minor_vers
raise ResourceNotFoundError("Relay server not found.") from ex
raise AzureResponseError("Failed to get relay connection string.") from ex

if self.SERVICE_BUS_CONNECTION_STRING not in configuration_protected_settings:
if original_extension.configuration_settings.get(self.SERVICE_BUS_ENABLED).lower() != 'false' \
and self.SERVICE_BUS_CONNECTION_STRING not in configuration_protected_settings:
try:
service_bus_connection_string, _ = _get_service_bus_connection_string(
cmd, subscription_id, resource_group_name, cluster_name, '', {}, True)
Expand Down Expand Up @@ -494,7 +517,8 @@ def __create_required_resource(
configuration_settings[self.AZURE_LOG_ANALYTICS_CUSTOMER_ID_KEY] = ws_costumer_id
configuration_protected_settings[self.AZURE_LOG_ANALYTICS_CONNECTION_STRING] = shared_key

if not configuration_settings.get(self.RELAY_SERVER_CONNECTION_STRING) and \
if str(configuration_settings.get(self.RELAY_SERVER_ENABLED)).lower() != 'false' and \
not configuration_settings.get(self.RELAY_SERVER_CONNECTION_STRING) and \
not configuration_protected_settings.get(self.RELAY_SERVER_CONNECTION_STRING):
logger.info('==== BEGIN RELAY CREATION ====')
relay_connection_string, hc_resource_id, hc_name = _get_relay_connection_str(
Expand All @@ -504,7 +528,8 @@ def __create_required_resource(
configuration_settings[self.HC_RESOURCE_ID_KEY] = hc_resource_id
configuration_settings[self.RELAY_HC_NAME_KEY] = hc_name

if not configuration_settings.get(self.SERVICE_BUS_CONNECTION_STRING) and \
if str(configuration_settings.get(self.SERVICE_BUS_ENABLED)).lower() != 'false' and \
not configuration_settings.get(self.SERVICE_BUS_CONNECTION_STRING) and \
not configuration_protected_settings.get(self.SERVICE_BUS_CONNECTION_STRING):
logger.info('==== BEGIN SERVICE BUS CREATION ====')
topic_sub_mapping = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ def Update(
version,
configuration_settings,
configuration_protected_settings,
original_extension: Extension,
yes=False,
):
"""Default validations & defaults for Update
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ def Update(
version: str,
configuration_settings: dict,
configuration_protected_settings: dict,
original_extension: Extension,
yes: bool,
) -> PatchExtension:
pass
Expand Down
3 changes: 0 additions & 3 deletions testing/test/extensions/public/AzureMLKubernetes.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,8 @@ Describe 'AzureML Kubernetes Testing' {
It "Deletes the extension from the cluster with inference enabled" {
# cleanup the relay and servicebus
$relayResourceID = Get-ExtensionConfigurationSettings $extensionName $relayResourceIDKey
$serviceBusResourceID = Get-ExtensionConfigurationSettings $extensionName $serviceBusResourceIDKey
$relayNamespaceName = $relayResourceID.split("/")[8]
$serviceBusNamespaceName = $serviceBusResourceID.split("/")[8]
az relay namespace delete --resource-group $ENVCONFIG.resourceGroup --name $relayNamespaceName
az servicebus namespace delete --resource-group $ENVCONFIG.resourceGroup --name $serviceBusNamespaceName

$output = az $Env:K8sExtensionName delete -c $($ENVCONFIG.arcClusterName) -g $($ENVCONFIG.resourceGroup) --cluster-type connectedClusters -n $extensionName --force
$? | Should -BeTrue
Expand Down