Skip to content

Commit 60a4755

Browse files
authored
Add --tier and --k8s-support-plan params to 'az aks upgrade' (Azure#9785)
1 parent b810f8d commit 60a4755

6 files changed

Lines changed: 3202 additions & 0 deletions

File tree

src/aks-preview/HISTORY.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ To release a new version, please select a new version number (usually plus 1 to
1111

1212
Pending
1313
+++++++
14+
* `az aks upgrade`: Add `--k8s-support-plan` and `--tier` flag support to allow cluster support plan and tier configuration during cluster upgrade.
1415

1516
20.0.0b6
1617
++++++

src/aks-preview/azext_aks_preview/_help.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -893,6 +893,12 @@
893893
type: string
894894
short-summary: Until when the cluster upgradeSettings overrides are effective.
895895
long-summary: It needs to be in a valid date-time format that's within the next 30 days. For example, 2023-04-01T13:00:00Z. Note that if --force-upgrade is set to true and --upgrade-override-until is not set, by default it will be set to 3 days from now.
896+
- name: --k8s-support-plan
897+
type: string
898+
short-summary: Choose from "KubernetesOfficial" or "AKSLongTermSupport". With "AKSLongTermSupport" you get 1 extra year of CVE patches.
899+
- name: --tier
900+
type: string
901+
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. '--tier premium' is required for '--k8s-support-plan AKSLongTermSupport'.
896902
- name: --if-match
897903
type: string
898904
short-summary: The value provided will be compared to the ETag of the managed cluster, if it matches the operation will proceed. If it does not match, the request will be rejected to prevent accidental overwrites. This must not be specified when creating a new cluster.

src/aks-preview/azext_aks_preview/_params.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1940,6 +1940,8 @@ def load_arguments(self, _):
19401940
validator=validate_force_upgrade_disable_and_enable_parameters
19411941
)
19421942
c.argument('upgrade_override_until')
1943+
c.argument("k8s_support_plan", arg_type=get_enum_type(k8s_support_plans))
1944+
c.argument("tier", arg_type=get_enum_type(sku_tiers), validator=validate_sku_tier)
19431945

19441946
with self.argument_context("aks scale") as c:
19451947
c.argument(

src/aks-preview/azext_aks_preview/custom.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@
6161
CONST_ARTIFACT_SOURCE_DIRECT,
6262
CONST_K8S_EXTENSION_CUSTOM_MOD_NAME,
6363
CONST_K8S_EXTENSION_CLIENT_FACTORY_MOD_NAME,
64+
CONST_MANAGED_CLUSTER_SKU_TIER_PREMIUM,
6465
)
6566
from azext_aks_preview._helpers import (
6667
check_is_private_link_cluster,
@@ -176,6 +177,7 @@
176177
ResourceNotFoundError,
177178
HttpResponseError,
178179
)
180+
from azure.mgmt.containerservice.models import KubernetesSupportPlan
179181
from dateutil.parser import parse
180182
from knack.log import get_logger
181183
from knack.prompting import prompt_y_n
@@ -1686,6 +1688,8 @@ def aks_upgrade(cmd,
16861688
enable_force_upgrade=False,
16871689
disable_force_upgrade=False,
16881690
upgrade_override_until=None,
1691+
tier=None,
1692+
k8s_support_plan=None,
16891693
yes=False,
16901694
if_match=None,
16911695
if_none_match=None):
@@ -1743,6 +1747,18 @@ def aks_upgrade(cmd,
17431747
disable_force_upgrade=disable_force_upgrade,
17441748
upgrade_override_until=upgrade_override_until)
17451749

1750+
if tier is not None:
1751+
instance.sku.tier = tier
1752+
1753+
if k8s_support_plan is not None:
1754+
instance.support_plan = k8s_support_plan
1755+
1756+
if (
1757+
instance.support_plan == KubernetesSupportPlan.AKS_LONG_TERM_SUPPORT
1758+
and instance.sku.tier is not None
1759+
and instance.sku.tier.lower() != CONST_MANAGED_CLUSTER_SKU_TIER_PREMIUM.lower()
1760+
):
1761+
raise CLIError("AKS Long Term Support is only available for Premium tier clusters.")
17461762
if instance.kubernetes_version == kubernetes_version:
17471763
if instance.provisioning_state == "Succeeded":
17481764
logger.warning("The cluster is already on version %s and is not in a failed state. No operations "

0 commit comments

Comments
 (0)