Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
9 changes: 0 additions & 9 deletions src/azure-cli/azure/cli/command_modules/acs/_help.py
Original file line number Diff line number Diff line change
Expand Up @@ -327,9 +327,6 @@
- name: --enable-high-log-scale-mode
type: bool
short-summary: Enable High Log Scale Mode for Container Logs.
- name: --uptime-sla
type: bool
short-summary: --uptime-sla is deprecated. Please use '--tier standard' instead.
- name: --tier
type: string
short-summary: Specify SKU tier for managed clusters. '--tier standard' enables a standard managed cluster service with a financially backed SLA. '--tier free' does not have a financially backed SLA.
Expand Down Expand Up @@ -654,12 +651,6 @@
- name: --max-count
type: int
short-summary: Maximum nodes count used for autoscaler, when "--enable-cluster-autoscaler" specified. Please specify the value in the range of [1, 1000]
- name: --uptime-sla
type: bool
short-summary: Enable a standard managed cluster service with a financially backed SLA. --uptime-sla is deprecated. Please use '--tier standard' instead.
- name: --no-uptime-sla
type: bool
short-summary: Change a standard managed cluster to a free one. --no-uptime-sla is deprecated. Please use '--tier free' instead.
- name: --tier
type: string
short-summary: Specify SKU tier for managed clusters. '--tier standard' enables a standard managed cluster service with a financially backed SLA. '--tier free' changes a standard managed cluster to a free one.
Expand Down
3 changes: 0 additions & 3 deletions src/azure-cli/azure/cli/command_modules/acs/_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,6 @@ def load_arguments(self, _):
c.argument('node_os_upgrade_channel', arg_type=get_enum_type(node_os_upgrade_channels))
c.argument('cluster_autoscaler_profile', nargs='+', options_list=["--cluster-autoscaler-profile", "--ca-profile"],
help="Comma-separated list of key=value pairs for configuring cluster autoscaler. Pass an empty string to clear the profile.")
c.argument('uptime_sla', action='store_true', deprecate_info=c.deprecate(target='--uptime-sla', hide=True))
c.argument('tier', arg_type=get_enum_type(sku_tiers), validator=validate_sku_tier)
c.argument('fqdn_subdomain')
c.argument('api_server_authorized_ip_ranges', validator=validate_ip_ranges)
Expand Down Expand Up @@ -489,8 +488,6 @@ def load_arguments(self, _):
c.argument('auto_upgrade_channel', arg_type=get_enum_type(auto_upgrade_channels))
c.argument('cluster_autoscaler_profile', nargs='+', options_list=["--cluster-autoscaler-profile", "--ca-profile"],
help="Comma-separated list of key=value pairs for configuring cluster autoscaler. Pass an empty string to clear the profile.")
c.argument('uptime_sla', action='store_true', deprecate_info=c.deprecate(target='--uptime-sla', hide=True))
c.argument('no_uptime_sla', action='store_true', deprecate_info=c.deprecate(target='--no-uptime-sla', hide=True))
c.argument('tier', arg_type=get_enum_type(sku_tiers), validator=validate_sku_tier)
c.argument('api_server_authorized_ip_ranges', validator=validate_ip_ranges)
# private cluster parameters
Expand Down
3 changes: 0 additions & 3 deletions src/azure-cli/azure/cli/command_modules/acs/custom.py
Original file line number Diff line number Diff line change
Expand Up @@ -519,7 +519,6 @@ def aks_create(
auto_upgrade_channel=None,
node_os_upgrade_channel=None,
cluster_autoscaler_profile=None,
uptime_sla=False,
tier=None,
fqdn_subdomain=None,
api_server_authorized_ip_ranges=None,
Expand Down Expand Up @@ -705,8 +704,6 @@ def aks_update(
auto_upgrade_channel=None,
node_os_upgrade_channel=None,
cluster_autoscaler_profile=None,
uptime_sla=False,
no_uptime_sla=False,
tier=None,
api_server_authorized_ip_ranges=None,
enable_public_fqdn=False,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4498,41 +4498,6 @@ def update_azure_service_mesh_profile(self) -> ServiceMeshProfile:
return new_profile
return self.mc.service_mesh_profile

def _get_uptime_sla(self, enable_validation: bool = False) -> bool:
"""Internal function to obtain the value of uptime_sla.

This function supports the option of enable_validation. When enabled, if both uptime_sla and no_uptime_sla are
specified, raise a MutuallyExclusiveArgumentError.

:return: bool
"""
# read the original value passed by the command
uptime_sla = self.raw_param.get("uptime_sla")

# In create mode, try to read the property value corresponding to the parameter from the `mc` object.
if self.decorator_mode == DecoratorMode.CREATE:
if (
self.mc and
self.mc.sku and
self.mc.sku.tier is not None
):
uptime_sla = self.mc.sku.tier == "Standard"

# this parameter does not need dynamic completion
# validation
if enable_validation:
if uptime_sla and self._get_no_uptime_sla(enable_validation=False):
raise MutuallyExclusiveArgumentError(
'Cannot specify "--uptime-sla" and "--no-uptime-sla" at the same time.'
)

if uptime_sla and self.get_tier() == CONST_MANAGED_CLUSTER_SKU_TIER_FREE:
raise MutuallyExclusiveArgumentError(
'Cannot specify "--uptime-sla" and "--tier free" at the same time.'
)

return uptime_sla

def get_tier(self) -> str:
"""Obtain the value of tier.

Expand All @@ -4542,66 +4507,7 @@ def get_tier(self) -> str:
if not tier:
return ""

tierStr = tier.lower()
if tierStr == CONST_MANAGED_CLUSTER_SKU_TIER_FREE and self._get_uptime_sla(enable_validation=False):
raise MutuallyExclusiveArgumentError(
'Cannot specify "--uptime-sla" and "--tier free" at the same time.'
)

if tierStr == CONST_MANAGED_CLUSTER_SKU_TIER_STANDARD and self._get_no_uptime_sla(enable_validation=False):
raise MutuallyExclusiveArgumentError(
'Cannot specify "--no-uptime-sla" and "--tier standard" at the same time.'
)

return tierStr

def get_uptime_sla(self) -> bool:
"""Obtain the value of uptime_sla.

This function will verify the parameter by default. If both uptime_sla and no_uptime_sla are specified, raise
a MutuallyExclusiveArgumentError.

:return: bool
"""
return self._get_uptime_sla(enable_validation=True)

def _get_no_uptime_sla(self, enable_validation: bool = False) -> bool:
"""Internal function to obtain the value of no_uptime_sla.

This function supports the option of enable_validation. When enabled, if both uptime_sla and no_uptime_sla are
specified, raise a MutuallyExclusiveArgumentError.

:return: bool
"""
# read the original value passed by the command
no_uptime_sla = self.raw_param.get("no_uptime_sla")
# We do not support this option in create mode, therefore we do not read the value from `mc`.

# this parameter does not need dynamic completion
# validation
if enable_validation:
if no_uptime_sla and self._get_uptime_sla(enable_validation=False):
raise MutuallyExclusiveArgumentError(
'Cannot specify "--uptime-sla" and "--no-uptime-sla" at the same time.'
)

if no_uptime_sla and self.get_tier() == CONST_MANAGED_CLUSTER_SKU_TIER_STANDARD:
raise MutuallyExclusiveArgumentError(
'Cannot specify "--no-uptime-sla" and "--tier standard" at the same time.'
)

return no_uptime_sla

def get_no_uptime_sla(self) -> bool:
"""Obtain the value of no_uptime_sla.

This function will verify the parameter by default. If both uptime_sla and no_uptime_sla are specified, raise
a MutuallyExclusiveArgumentError.

:return: bool
"""

return self._get_no_uptime_sla(enable_validation=True)
return tier.lower()

def get_defender_config(self) -> Union[ManagedClusterSecurityProfileDefender, None]:
"""Obtain the value of defender.
Expand Down Expand Up @@ -6516,7 +6422,7 @@ def set_up_sku(self, mc: ManagedCluster) -> ManagedCluster:
"""
self._ensure_mc(mc)

if self.context.get_uptime_sla() or self.context.get_tier() == CONST_MANAGED_CLUSTER_SKU_TIER_STANDARD:
if self.context.get_tier() == CONST_MANAGED_CLUSTER_SKU_TIER_STANDARD:
mc.sku = self.models.ManagedClusterSKU(
name="Base",
tier="Standard"
Expand Down Expand Up @@ -7255,13 +7161,13 @@ def update_sku(self, mc: ManagedCluster) -> ManagedCluster:
tier="Premium"
)

if self.context.get_uptime_sla() or self.context.get_tier() == CONST_MANAGED_CLUSTER_SKU_TIER_STANDARD:
if self.context.get_tier() == CONST_MANAGED_CLUSTER_SKU_TIER_STANDARD:
mc.sku = self.models.ManagedClusterSKU(
name="Base",
tier="Standard"
)

if self.context.get_no_uptime_sla() or self.context.get_tier() == CONST_MANAGED_CLUSTER_SKU_TIER_FREE:
if self.context.get_tier() == CONST_MANAGED_CLUSTER_SKU_TIER_FREE:
mc.sku = self.models.ManagedClusterSKU(
name="Base",
tier="Free"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2099,10 +2099,11 @@ def test_aks_create_with_paid_sku(self, resource_group, resource_group_location,
'client_secret': sp_password,
'resource_type': 'Microsoft.ContainerService/ManagedClusters'
})

# create
create_cmd = 'aks create --resource-group={resource_group} --name={name} --location={location} ' \
'--dns-name-prefix={dns_name_prefix} --node-count=1 --ssh-key-value={ssh_key_value} ' \
'--service-principal={service_principal} --client-secret={client_secret} --uptime-sla '
'--service-principal={service_principal} --client-secret={client_secret} --tier standard '
self.cmd(create_cmd, checks=[
self.exists('fqdn'),
self.exists('nodeResourceGroup'),
Expand Down Expand Up @@ -5262,21 +5263,21 @@ def test_aks_create_with_paid_sku_msi(self, resource_group, resource_group_locat
# create
create_cmd = 'aks create --resource-group={resource_group} --name={name} --location={location} ' \
'--dns-name-prefix={dns_name_prefix} --node-count=1 --ssh-key-value={ssh_key_value} ' \
'--uptime-sla'
'--tier standard'
self.cmd(create_cmd, checks=[
self.exists('fqdn'),
self.exists('nodeResourceGroup'),
self.check('provisioningState', 'Succeeded'),
self.check('sku.tier', 'Standard')
])
# update to no uptime sla
no_uptime_sla_cmd = 'aks update --resource-group={resource_group} --name={name} --no-uptime-sla'
self.cmd(no_uptime_sla_cmd, checks=[
# update to free tier
free_tier_cmd = 'aks update --resource-group={resource_group} --name={name} --tier free'
self.cmd(free_tier_cmd, checks=[
self.check('sku.tier', 'Free')
])
# update to uptime sla again
uptime_sla_cmd = 'aks update --resource-group={resource_group} --name={name} --uptime-sla'
self.cmd(uptime_sla_cmd, checks=[
standard_tier_cmd = 'aks update --resource-group={resource_group} --name={name} --tier standard'
self.cmd(standard_tier_cmd, checks=[
self.check('sku.tier', 'Standard')
])
# delete
Expand Down
Loading