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
4 changes: 4 additions & 0 deletions src/aks-preview/HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ To release a new version, please select a new version number (usually plus 1 to
Pending
+++++++

18.0.0b3
+++++++
* Add basic lb sku migration support `az aks update --load-balancer-sku standard`

18.0.0b2
+++++++
* Vendor new SDK and bump API version to 2025-03-02-preview.
Expand Down
6 changes: 6 additions & 0 deletions src/aks-preview/azext_aks_preview/_help.py
Original file line number Diff line number Diff line change
Expand Up @@ -816,6 +816,10 @@
- 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.
- name: --load-balancer-sku
type: string
short-summary: Azure Load Balancer SKU selection for your cluster. only standard is accepted.
long-summary: Upgrade to Standard Azure Load Balancer SKU for your AKS cluster.
- name: --load-balancer-managed-outbound-ip-count
type: int
short-summary: Load balancer managed outbound IP count.
Expand Down Expand Up @@ -1267,6 +1271,8 @@
text: az aks update --disable-cluster-autoscaler -g MyResourceGroup -n MyManagedCluster
- name: Update min-count or max-count for cluster autoscaler.
text: az aks update --update-cluster-autoscaler --min-count 1 --max-count 10 -g MyResourceGroup -n MyManagedCluster
- name: Upgrade load balancer sku to standard
text: az aks update --load-balancer-sku standard -g MyResourceGroup -n MyManagedCluster
- name: Update a kubernetes cluster with standard SKU load balancer to use two AKS created IPs for the load balancer outbound connection usage.
text: az aks update -g MyResourceGroup -n MyManagedCluster --load-balancer-managed-outbound-ip-count 2
- name: Update a kubernetes cluster with standard SKU load balancer to use the provided public IPs for the load balancer outbound connection usage.
Expand Down
5 changes: 5 additions & 0 deletions src/aks-preview/azext_aks_preview/_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -997,6 +997,11 @@ def load_arguments(self, _):
# managed cluster paramerters
c.argument("disable_local_accounts", action="store_true")
c.argument("enable_local_accounts", action="store_true")
c.argument(
"load_balancer_sku",
arg_type=get_enum_type([CONST_LOAD_BALANCER_SKU_STANDARD]),
validator=validate_load_balancer_sku,
)
c.argument("load_balancer_managed_outbound_ip_count", type=int)
c.argument(
"load_balancer_outbound_ips", validator=validate_load_balancer_outbound_ips
Expand Down
1 change: 1 addition & 0 deletions src/aks-preview/azext_aks_preview/custom.py
Original file line number Diff line number Diff line change
Expand Up @@ -598,6 +598,7 @@ def aks_update(
tags=None,
disable_local_accounts=False,
enable_local_accounts=False,
load_balancer_sku=None,
load_balancer_managed_outbound_ip_count=None,
load_balancer_outbound_ips=None,
load_balancer_outbound_ip_prefixes=None,
Expand Down
47 changes: 46 additions & 1 deletion src/aks-preview/azext_aks_preview/managed_cluster_decorator.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
CONST_AZURE_SERVICE_MESH_UPGRADE_COMMAND_START,
CONST_AZURE_SERVICE_MESH_DEFAULT_EGRESS_NAMESPACE,
CONST_LOAD_BALANCER_SKU_BASIC,
CONST_LOAD_BALANCER_SKU_STANDARD,
CONST_MANAGED_CLUSTER_SKU_NAME_BASE,
CONST_MANAGED_CLUSTER_SKU_NAME_AUTOMATIC,
CONST_MANAGED_CLUSTER_SKU_TIER_FREE,
Expand Down Expand Up @@ -86,6 +85,7 @@
CONST_OUTBOUND_TYPE_MANAGED_NAT_GATEWAY,
CONST_OUTBOUND_TYPE_USER_ASSIGNED_NAT_GATEWAY,
CONST_OUTBOUND_TYPE_USER_DEFINED_ROUTING,
CONST_LOAD_BALANCER_SKU_STANDARD,
DecoratorEarlyExitException,
DecoratorMode,
)
Expand Down Expand Up @@ -347,6 +347,48 @@ def get_enable_msi_auth_for_monitoring(self) -> Union[bool, None]:
return True
return enable_msi_auth_for_monitoring

def _get_load_balancer_sku(self, enable_validation: bool = False) -> Union[str, None]:
"""Internal function to obtain the value of load_balancer_sku, default value is
CONST_LOAD_BALANCER_SKU_STANDARD.

Note: When returning a string, it will always be lowercase.

This function supports the option of enable_validation. When enabled, it will check if load_balancer_sku equals
to CONST_LOAD_BALANCER_SKU_BASIC, if so, when api_server_authorized_ip_ranges is assigned or
enable_private_cluster is specified, raise an InvalidArgumentValueError.

:return: string or None
"""
# read the original value passed by the command
load_balancer_sku = safe_lower(self.raw_param.get("load_balancer_sku"))
# try to read the property value corresponding to the parameter from the `mc` object
if (
load_balancer_sku is None and
self.mc and
self.mc.network_profile and
self.mc.network_profile.load_balancer_sku is not None
):
load_balancer_sku = safe_lower(
self.mc.network_profile.load_balancer_sku
)
if self.decorator_mode == DecoratorMode.CREATE and load_balancer_sku is None:
# default value
load_balancer_sku = CONST_LOAD_BALANCER_SKU_STANDARD

# validation
if enable_validation:
if load_balancer_sku == CONST_LOAD_BALANCER_SKU_BASIC:
if self._get_api_server_authorized_ip_ranges(enable_validation=False):
raise InvalidArgumentValueError(
"--api-server-authorized-ip-ranges can only be used with standard load balancer"
)
if self._get_enable_private_cluster(enable_validation=False):
raise InvalidArgumentValueError(
"Please use standard load balancer for private cluster"
)

return load_balancer_sku

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

Expand Down Expand Up @@ -3972,6 +4014,9 @@ def update_network_profile(self, mc: ManagedCluster) -> ManagedCluster:

self.update_network_plugin_settings(mc)

loadbalancer_sku = self.context.get_load_balancer_sku()
if loadbalancer_sku:
mc.network_profile.load_balancer_sku = loadbalancer_sku
return mc

def update_network_plugin_settings(self, mc: ManagedCluster) -> ManagedCluster:
Expand Down
Loading
Loading