Skip to content

Commit

Permalink
{AKS} [BREAKING CHANGE]: az aks create/update: Remove `--uptime-sla…
Browse files Browse the repository at this point in the history
…` and `--no-uptime-sla` options (Azure#8229)
  • Loading branch information
FumingZhang authored and chrisribe committed Nov 13, 2024
1 parent 312dca7 commit ac7e4df
Show file tree
Hide file tree
Showing 7 changed files with 9 additions and 212 deletions.
4 changes: 4 additions & 0 deletions src/aks-preview/HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ If there is no rush to release a new version, please just add a description of t

To release a new version, please select a new version number (usually plus 1 to last patch version, X.Y.Z -> Major.Minor.Patch, more details in `\doc <https://semver.org/>`_), and then add a new section named as the new version number in this file, the content should include the new modifications and everything from the *Pending* section. Finally, update the `VERSION` variable in `setup.py` with this new version number.

10.0.0b1
++++++++
* [BREAKING CHANGE]: `az aks create/update`: Remove `--uptime-sla` and `--no-uptime-sla` options.

9.0.0b8
+++++++
* Update VM SKU validations to get values from backend API for Azure Container Storage.
Expand Down
9 changes: 0 additions & 9 deletions src/aks-preview/azext_aks_preview/_help.py
Original file line number Diff line number Diff line change
Expand Up @@ -329,9 +329,6 @@
type: string
short-summary: Restriction level on the managed node resource group.
long-summary: The restriction level of permissions allowed on the cluster's managed node resource group, supported values are Unrestricted, and ReadOnly (recommended ReadOnly).
- name: --uptime-sla
type: bool
short-summary: --uptime-sla is deprecated. Please use '--tier standard' instead.
- name: --sku
type: string
short-summary: Specify SKU name for managed clusters. '--sku base' enables a base managed cluster. '--sku automatic' enables an automatic managed cluster.
Expand Down Expand Up @@ -828,12 +825,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: --sku
type: string
short-summary: Specify SKU name for managed clusters. '--sku base' enables a base managed cluster. '--sku automatic' enables an automatic managed cluster.
Expand Down
21 changes: 0 additions & 21 deletions src/aks-preview/azext_aks_preview/_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -562,13 +562,6 @@ def load_arguments(self, _):
"Pass an empty string to clear the profile."
),
)
c.argument(
"uptime_sla",
action="store_true",
deprecate_info=c.deprecate(
target="--uptime-sla", redirect="--tier", hide=True
),
)
c.argument(
"sku", is_preview=True, arg_type=get_enum_type(sku_names)
)
Expand Down Expand Up @@ -1071,20 +1064,6 @@ def load_arguments(self, _):
"Pass an empty string to clear the profile."
),
)
c.argument(
"uptime_sla",
action="store_true",
deprecate_info=c.deprecate(
target="--uptime-sla", redirect="--tier", hide=True
),
)
c.argument(
"no_uptime_sla",
action="store_true",
deprecate_info=c.deprecate(
target="--no-uptime-sla", redirect="--tier", hide=True
),
)
c.argument(
"sku", is_preview=True, arg_type=get_enum_type(sku_names)
)
Expand Down
3 changes: 0 additions & 3 deletions src/aks-preview/azext_aks_preview/custom.py
Original file line number Diff line number Diff line change
Expand Up @@ -370,7 +370,6 @@ def aks_create(
auto_upgrade_channel=None,
node_os_upgrade_channel=None,
cluster_autoscaler_profile=None,
uptime_sla=False,
sku=None,
tier=None,
fqdn_subdomain=None,
Expand Down Expand Up @@ -610,8 +609,6 @@ def aks_update(
disable_force_upgrade=False,
upgrade_override_until=None,
cluster_autoscaler_profile=None,
uptime_sla=False,
no_uptime_sla=False,
sku=None,
tier=None,
api_server_authorized_ip_ranges=None,
Expand Down
85 changes: 4 additions & 81 deletions src/aks-preview/azext_aks_preview/managed_cluster_decorator.py
Original file line number Diff line number Diff line change
Expand Up @@ -2590,72 +2590,6 @@ def _get_k8s_support_plan(self) -> KubernetesSupportPlan:
support_plan = self.raw_param.get("k8s_support_plan")
return support_plan

def _get_uptime_sla(self, enable_validation: bool = False) -> bool:
"""Internal function to obtain the value of uptime_sla.
Note: Overwritten in aks-preview to add support for the new option tier. Could be removed after updating
the dependency on core cli to 2.47.0.
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_no_uptime_sla(self, enable_validation: bool = False) -> bool:
"""Internal function to obtain the value of no_uptime_sla.
Note: Overwritten in aks-preview to add support for the new option tier. Could be removed after updating
the dependency on core cli to 2.47.0.
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_tier(self) -> str:
"""Obtain the value of tier.
Expand All @@ -2667,18 +2601,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
return tier.lower()

def get_k8s_support_plan(self) -> Union[str, None]:
"""Obtain the value of kubernetes_support_plan.
Expand Down Expand Up @@ -3530,7 +3453,7 @@ def set_up_sku(self, mc: ManagedCluster) -> ManagedCluster:
# passive Kind should always match sku.name
mc.kind = "Base"

if self.context.get_uptime_sla() or tier == CONST_MANAGED_CLUSTER_SKU_TIER_STANDARD:
if tier == CONST_MANAGED_CLUSTER_SKU_TIER_STANDARD:
mc.sku.tier = "Standard"
if tier == CONST_MANAGED_CLUSTER_SKU_TIER_PREMIUM:
mc.sku.tier = "Premium"
Expand Down Expand Up @@ -5021,9 +4944,9 @@ def update_sku(self, mc: ManagedCluster) -> ManagedCluster:
# Premium without LTS is ok (not vice versa)
if tier == CONST_MANAGED_CLUSTER_SKU_TIER_PREMIUM:
mc.sku.tier = "Premium"
if self.context.get_uptime_sla() or tier == CONST_MANAGED_CLUSTER_SKU_TIER_STANDARD:
if tier == CONST_MANAGED_CLUSTER_SKU_TIER_STANDARD:
mc.sku.tier = "Standard"
if self.context.get_no_uptime_sla() or tier == CONST_MANAGED_CLUSTER_SKU_TIER_FREE:
if tier == CONST_MANAGED_CLUSTER_SKU_TIER_FREE:
mc.sku.tier = "Free"
# backfill the tier to "Free" if it's not set
if mc.sku.tier is None:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5587,26 +5587,6 @@ def test_set_up_sku(self):
)
self.assertEqual(dec_mc_2, expect_mc_2)

dec_3 = AKSPreviewManagedClusterCreateDecorator(
self.cmd,
self.client,
{"uptime_sla": True},
CUSTOM_MGMT_AKS_PREVIEW,
)
mc_3 = self.models.ManagedCluster(
location="test_location",
sku=None,
)
dec_3.context.attach_mc(mc_3)
dec_mc_3 = dec_3.set_up_sku(mc_3)
baseSKU = self.models.ManagedClusterSKU(name="Base", tier="Standard")
expect_mc_3 = self.models.ManagedCluster(
location="test_location",
sku=baseSKU,
kind="Base",
)
self.assertEqual(dec_mc_3, expect_mc_3)


class AKSPreviewManagedClusterUpdateDecoratorTestCase(unittest.TestCase):
def setUp(self):
Expand Down Expand Up @@ -8645,83 +8625,6 @@ def test_update_sku(self):
)
self.assertEqual(dec_mc_2, expect_mc_2)

dec_3 = AKSPreviewManagedClusterUpdateDecorator(
self.cmd,
self.client,
{
"uptime_sla": True,
"no_uptime_sla": True,
},
CUSTOM_MGMT_AKS_PREVIEW,
)
mc_3 = self.models.ManagedCluster(
location="test_location",
sku=self.models.ManagedClusterSKU(
name="Base",
tier="Free",
),
)
dec_3.context.attach_mc(mc_3)
# fail on mutually exclusive uptime_sla and no_uptime_sla
with self.assertRaises(MutuallyExclusiveArgumentError):
dec_3.update_sku(mc_3)

dec_4 = AKSPreviewManagedClusterUpdateDecorator(
self.cmd,
self.client,
{
"uptime_sla": False,
"no_uptime_sla": True,
},
CUSTOM_MGMT_AKS_PREVIEW,
)
mc_4 = self.models.ManagedCluster(
location="test_location",
sku=self.models.ManagedClusterSKU(
name="Base",
tier="Standard",
),
)
dec_4.context.attach_mc(mc_4)
dec_mc_4 = dec_4.update_sku(mc_4)
ground_truth_mc_4 = self.models.ManagedCluster(
location="test_location",
sku=self.models.ManagedClusterSKU(
name="Base",
tier="Free",
),
kind="Base",
)
self.assertEqual(dec_mc_4, ground_truth_mc_4)

dec_5 = AKSPreviewManagedClusterUpdateDecorator(
self.cmd,
self.client,
{
"uptime_sla": True,
"no_uptime_sla": False,
},
CUSTOM_MGMT_AKS_PREVIEW,
)
mc_5 = self.models.ManagedCluster(
location="test_location",
sku=self.models.ManagedClusterSKU(
name="Base",
tier="Free",
),
)
dec_5.context.attach_mc(mc_5)
dec_mc_5 = dec_5.update_sku(mc_5)
ground_truth_mc_5 = self.models.ManagedCluster(
location="test_location",
sku=self.models.ManagedClusterSKU(
name="Base",
tier="Standard",
),
kind="Base",
)
self.assertEqual(dec_mc_5, ground_truth_mc_5)

def test_setup_supportPlan(self):
# default value in `aks_create`
ltsDecorator = AKSPreviewManagedClusterCreateDecorator(
Expand Down
2 changes: 1 addition & 1 deletion src/aks-preview/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

from setuptools import setup, find_packages

VERSION = "9.0.0b8"
VERSION = "10.0.0b1"

CLASSIFIERS = [
"Development Status :: 4 - Beta",
Expand Down

0 comments on commit ac7e4df

Please sign in to comment.