Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
1a5fbbd
Application Gateway for Containers add-on commands
JackStromberg Nov 4, 2025
d7f5571
Update HISTORY.rst
JackStromberg Nov 4, 2025
88d3432
Update HISTORY.rst
JackStromberg Nov 4, 2025
e242cd0
Merge branch 'main' into agc-addon
JackStromberg Nov 4, 2025
3e75d7c
Update HISTORY.rst
JackStromberg Nov 4, 2025
ad4b754
Update HISTORY.rst
JackStromberg Nov 4, 2025
0e8b3ba
Update src/aks-preview/azext_aks_preview/managed_cluster_decorator.py
JackStromberg Nov 4, 2025
c40c3af
tests
JackStromberg Nov 11, 2025
7ee983e
Merge branch 'main' into agc-addon
JackStromberg Nov 12, 2025
e2a2c16
enable params
JackStromberg Nov 13, 2025
11aed85
parameter length linter exclusion
JackStromberg Nov 13, 2025
5998eb8
Enable gateway api
JackStromberg Dec 12, 2025
78a9f91
Missing update and passing test
JackStromberg Dec 12, 2025
055a3f7
Linter exception
JackStromberg Dec 12, 2025
47208c6
Linter - take 2
JackStromberg Dec 12, 2025
9520b8f
Update HISTORY.rst
JackStromberg Dec 12, 2025
560f0f5
Update src/aks-preview/azext_aks_preview/tests/latest/test_aks_comman…
JackStromberg Dec 12, 2025
3a4d8ba
Update src/aks-preview/azext_aks_preview/tests/latest/test_aks_comman…
JackStromberg Dec 12, 2025
8f01427
Update src/aks-preview/azext_aks_preview/tests/latest/test_aks_comman…
JackStromberg Dec 12, 2025
b5d36b8
Update src/aks-preview/azext_aks_preview/tests/latest/test_aks_comman…
JackStromberg Dec 12, 2025
f4692ea
Update src/aks-preview/azext_aks_preview/custom.py
JackStromberg Dec 12, 2025
7f34b1c
Update src/aks-preview/azext_aks_preview/tests/latest/test_aks_comman…
JackStromberg Dec 12, 2025
4dba0d8
Update custom.py
JackStromberg Dec 12, 2025
51e4e34
Merge branch 'Azure:main' into agc-addon
JackStromberg Dec 15, 2025
e967940
update test results
JackStromberg Dec 15, 2025
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: 9 additions & 0 deletions linter_exclusions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@ aks create:
enable_private_cluster:
rule_exclusions:
- option_length_too_long
enable_application_load_balancer:
rule_exclusions:
- option_length_too_long
load_balancer_idle_timeout:
rule_exclusions:
- option_length_too_long
Expand Down Expand Up @@ -198,6 +201,12 @@ aks update:
cluster_service_load_balancer_health_probe_mode:
rule_exclusions:
- option_length_too_long
enable_application_load_balancer:
rule_exclusions:
- option_length_too_long
disable_application_load_balancer:
rule_exclusions:
- option_length_too_long
aks agent:
parameters:
prompt:
Expand Down
5 changes: 5 additions & 0 deletions src/aks-preview/HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,11 @@ To release a new version, please select a new version number (usually plus 1 to

Pending
+++++++
* Add add-on support for `ApplicationLoadBalancer` (Application Gateway for Containers)
- AKS Create and Update parameters for `--enable-application-load-balancer` and `--disable-application-load-balancer`
- `az aks applicationloadbalancer enable`: Enable Application Load Balancer add-on for an existing cluster.
- `az aks applicationloadbalancer disable`: Disable Application Load Balancer add-on for an existing cluster.
- `az aks applicationloadbalancer update`: Update Application Load Balancer add-on for an existing cluster.

19.0.0b18
+++++++
Expand Down
9 changes: 8 additions & 1 deletion src/aks-preview/azext_aks_preview/_consts.py
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,9 @@
CONST_DISK_DRIVER_V2 = "v2"

# consts for addons
# application load balancer (Application Gateway for Containers)
CONST_APPLICATION_LOAD_BALANCER_ADDON_NAME = "applicationLoadBalancer"

# http application routing
CONST_HTTP_APPLICATION_ROUTING_ADDON_NAME = "httpApplicationRouting"

Expand Down Expand Up @@ -225,6 +228,7 @@

# all supported addons
ADDONS = {
"application-load-balancer": CONST_APPLICATION_LOAD_BALANCER_ADDON_NAME,
"http_application_routing": CONST_HTTP_APPLICATION_ROUTING_ADDON_NAME,
"monitoring": CONST_MONITORING_ADDON_NAME,
"virtual-node": CONST_VIRTUAL_NODE_ADDON_NAME,
Expand Down Expand Up @@ -255,7 +259,10 @@
"- enable Azure policy. The Azure Policy add-on for AKS enables at-scale enforcements and safeguards on "
"your clusters in a centralized, consistent manner.\nLearn more at aka.ms/aks/policy."
),
CONST_INGRESS_APPGW_ADDON_NAME: "- enable Application Gateway Ingress Controller addon (PREVIEW).",
CONST_APPLICATION_LOAD_BALANCER_ADDON_NAME: (
"- enable Application Load Balancer (Application Gateway for Containers) addon (PREVIEW)."
),
CONST_INGRESS_APPGW_ADDON_NAME: "- enable Application Gateway Ingress Controller addon.",
CONST_CONFCOM_ADDON_NAME: "- enable confcom addon, this will enable SGX device plugin by default (PREVIEW).",
CONST_OPEN_SERVICE_MESH_ADDON_NAME: "- enable Open Service Mesh addon (PREVIEW).",
CONST_AZURE_KEYVAULT_SECRETS_PROVIDER_ADDON_NAME: "- enable Azure Keyvault Secrets Provider addon.",
Expand Down
44 changes: 40 additions & 4 deletions src/aks-preview/azext_aks_preview/_help.py
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,8 @@
- monitoring : turn on Log Analytics monitoring. Uses the Log Analytics Default Workspace if it exists, else creates one. Specify "--workspace-resource-id" to use an existing workspace. If monitoring addon is enabled --no-wait argument will have no effect
- virtual-node : enable AKS Virtual Node. Requires --aci-subnet-name to provide the name of an existing subnet for the Virtual Node to use. aci-subnet-name must be in the same vnet which is specified by --vnet-subnet-id (required as well).
- azure-policy : enable Azure policy. The Azure Policy add-on for AKS enables at-scale enforcements and safeguards on your clusters in a centralized, consistent manner. Required if enabling deployment safeguards. Learn more at aka.ms/aks/policy.
- ingress-appgw : enable Application Gateway Ingress Controller addon (PREVIEW).
- application-load-balancer : enable the Application Load Balancer (Application Gateway for Containers) addon (PREVIEW).
- ingress-appgw : enable Application Gateway Ingress Controller addon.
- confcom : enable confcom addon, this will enable SGX device plugin by default(PREVIEW).
- open-service-mesh : enable Open Service Mesh addon (PREVIEW).
- gitops : enable GitOps (PREVIEW).
Expand Down Expand Up @@ -635,6 +636,9 @@
Auto: A standard set of Karpenter NodePools are provisioned.
None: No Karpenter NodePools are provisioned.
WARNING: Changing this from Auto to None on an existing cluster will cause the default Karpenter NodePools to be deleted, which will in turn drain and delete the nodes associated with those pools. It is strongly recommended to not do this unless there are idle nodes ready to take the pods evicted by that action.
- name: --enable-application-load-balancer
type: bool
short-summary: Enable Application Load Balancer (Application Gateway for Containers) addon.
- name: --enable-app-routing
type: bool
short-summary: Enable Application Routing addon.
Expand Down Expand Up @@ -1417,6 +1421,12 @@
- name: --disable-gateway-api
type: bool
short-summary: Disable managed installation of Gateway API CRDs.
- name: --enable-application-load-balancer
type: bool
short-summary: Enable Application Load Balancer (Application Gateway for Containers) addon.
- name: --disable-application-load-balancer
type: bool
short-summary: Disable Application Load Balancer (Application Gateway for Containers) addon.
examples:
- name: Reconcile the cluster back to its current state.
text: az aks update -g MyResourceGroup -n MyManagedCluster
Expand Down Expand Up @@ -2779,7 +2789,8 @@
virtual-node - enable AKS Virtual Node. Requires --subnet-name to provide the name of an existing subnet for the Virtual Node to use.
azure-policy - enable Azure policy. The Azure Policy add-on for AKS enables at-scale enforcements and safeguards on your clusters in a centralized, consistent manner.
Learn more at aka.ms/aks/policy.
ingress-appgw - enable Application Gateway Ingress Controller addon (PREVIEW).
application-load-balancer - enable the Application Load Balancer (Application Gateway for Containers) addon (PREVIEW).
ingress-appgw - enable Application Gateway Ingress Controller addon.
open-service-mesh - enable Open Service Mesh addon (PREVIEW).
gitops - enable GitOps (PREVIEW).
azure-keyvault-secrets-provider - enable Azure Keyvault Secrets Provider addon.
Expand Down Expand Up @@ -2939,7 +2950,8 @@
virtual-node - enable AKS Virtual Node. Requires --subnet-name to provide the name of an existing subnet for the Virtual Node to use.
azure-policy - enable Azure policy. The Azure Policy add-on for AKS enables at-scale enforcements and safeguards on your clusters in a centralized, consistent manner.
Learn more at aka.ms/aks/policy.
ingress-appgw - enable Application Gateway Ingress Controller addon (PREVIEW).
application-load-balancer - enable the Application Load Balancer (Application Gateway for Containers) addon (PREVIEW).
ingress-appgw - enable Application Gateway Ingress Controller addon.
open-service-mesh - enable Open Service Mesh addon (PREVIEW).
gitops - enable GitOps (PREVIEW).
azure-keyvault-secrets-provider - enable Azure Keyvault Secrets Provider addon.
Expand Down Expand Up @@ -3612,9 +3624,33 @@
text: az aks mesh disable-istio-cni --resource-group MyResourceGroup --name MyManagedCluster
"""

helps['aks applicationloadbalancer'] = """
type: group
short-summary: Commands to manage Application Load Balancer (Application Gateway for Containers) addon.
long-summary: A group of commands to manage Application Load Balancer (Application Gateway for Containers) in given cluster.
"""

helps['aks applicationloadbalancer enable'] = """
type: command
short-summary: Enable Application Load Balancer (Application Gateway for Containers) addon.
long-summary: This command enables Application Load Balancer in given cluster.
"""

helps['aks applicationloadbalancer update'] = """
type: command
short-summary: Update Application Load Balancer (Application Gateway for Containers) addon.
long-summary: This command is used to make a put operation on the Application Load Balancer in a given cluster.
"""

helps['aks applicationloadbalancer disable'] = """
type: command
short-summary: Disable Application Load Balancer (Application Gateway for Containers) addon.
long-summary: This command disables Application Load Balancer (Application Gateway for Containers) in given cluster.
"""

helps['aks approuting'] = """
type: group
short-summary: Commands to manage App Routing aadon.
short-summary: Commands to manage App Routing addon.
long-summary: A group of commands to manage App Routing in given cluster.
"""

Expand Down
13 changes: 13 additions & 0 deletions src/aks-preview/azext_aks_preview/_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -782,6 +782,7 @@ def load_arguments(self, _):
c.argument("enable_secret_rotation", action="store_true")
c.argument("rotation_poll_interval")
c.argument("enable_sgxquotehelper", action="store_true")
c.argument("enable_application_load_balancer", action="store_true", is_preview=True)
c.argument("enable_app_routing", action="store_true", is_preview=True)
c.argument(
"app_routing_default_nginx_controller",
Expand Down Expand Up @@ -1765,6 +1766,18 @@ def load_arguments(self, _):
action="store_true",
help="Disable managed installation of Gateway API CRDs."
)
c.argument(
"enable_application_load_balancer",
action="store_true",
is_preview=True,
help="Enable Application Load Balancer (Application Gateway for Containers)."
)
c.argument(
"disable_application_load_balancer",
action="store_true",
is_preview=True,
help="Disable Application Load Balancer (Application Gateway for Containers)."
)

with self.argument_context("aks upgrade") as c:
c.argument("kubernetes_version", completer=get_k8s_upgrades_completion_list)
Expand Down
18 changes: 18 additions & 0 deletions src/aks-preview/azext_aks_preview/addonconfiguration.py
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,11 @@ def update_addons(
resource_type=CUSTOM_MGMT_AKS_PREVIEW,
operation_group="managed_clusters",
)
ManagedClusterIngressProfileApplicationLoadBalancer = cmd.get_models(
"ManagedClusterIngressProfileApplicationLoadBalancer",
resource_type=CUSTOM_MGMT_AKS_PREVIEW,
operation_group="managed_clusters",
)
ManagedClusterIngressProfileWebAppRouting = cmd.get_models(
"ManagedClusterIngressProfileWebAppRouting",
resource_type=CUSTOM_MGMT_AKS_PREVIEW,
Expand All @@ -261,6 +266,19 @@ def update_addons(

# for each addons argument
for addon_arg in addon_args:
if addon_arg == "applicationloadbalancer":
# application load balancer settings are in ingress profile, not addon profile
if instance.ingress_profile is None:
instance.ingress_profile = ManagedClusterIngressProfile()
if instance.ingress_profile.application_load_balancer is None:
instance.ingress_profile.application_load_balancer = (
ManagedClusterIngressProfileApplicationLoadBalancer()
)

instance.ingress_profile.application_load_balancer.enabled = enable

continue

if addon_arg == "web_application_routing":
# web app routing settings are in ingress profile, not addon profile, so deal
# with it separately
Expand Down
8 changes: 8 additions & 0 deletions src/aks-preview/azext_aks_preview/commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -460,6 +460,14 @@ def load_command_table(self, _):
g.custom_command("complete", "aks_mesh_upgrade_complete", supports_no_wait=True)
g.custom_command("rollback", "aks_mesh_upgrade_rollback", supports_no_wait=True)

# AKS applicationloadbalancer (Application Gateway for Containers) commands
with self.command_group(
"aks applicationloadbalancer", managed_clusters_sdk, client_factory=cf_managed_clusters
) as g:
g.custom_command("enable", "aks_applicationloadbalancer_enable")
g.custom_command("disable", "aks_applicationloadbalancer_disable", confirmation=True)
g.custom_command("update", "aks_applicationloadbalancer_update")

# AKS approuting commands
with self.command_group(
"aks approuting", managed_clusters_sdk, client_factory=cf_managed_clusters
Expand Down
110 changes: 110 additions & 0 deletions src/aks-preview/azext_aks_preview/custom.py
Original file line number Diff line number Diff line change
Expand Up @@ -1025,6 +1025,7 @@ def aks_create(
enable_sgxquotehelper=False,
enable_secret_rotation=False,
rotation_poll_interval=None,
enable_application_load_balancer=False,
enable_app_routing=False,
app_routing_default_nginx_controller=None,
# nodepool paramerters
Expand Down Expand Up @@ -1399,6 +1400,9 @@ def aks_update(
# managed gateway installation
enable_gateway_api=False,
disable_gateway_api=False,
# application load balancer
enable_application_load_balancer=False,
disable_application_load_balancer=False,
):
# DO NOT MOVE: get all the original parameters and save them as a dictionary
raw_parameters = locals()
Expand Down Expand Up @@ -2665,6 +2669,12 @@ def aks_addon_list(cmd, client, resource_group_name, name):
mc.ingress_profile.web_app_routing and
mc.ingress_profile.web_app_routing.enabled
)
elif addon_name == "application-load-balancer":
enabled = bool(
mc.ingress_profile and
mc.ingress_profile.application_load_balancer and
mc.ingress_profile.application_load_balancer.enabled
)
else:
if addon_name == "virtual-node":
addon_key += os_type
Expand Down Expand Up @@ -2701,6 +2711,20 @@ def aks_addon_show(cmd, client, resource_group_name, name, addon):
"config": mc.ingress_profile.web_app_routing,
}

# application-load-balancer is a special case, the configuration is stored in a separate profile
if addon == "application-load-balancer":
if (
not mc.ingress_profile and
not mc.ingress_profile.application_load_balancer and
Comment thread
JackStromberg marked this conversation as resolved.
Comment on lines +2717 to +2718
Copy link

Copilot AI Dec 12, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The logic in this condition uses and instead of or, which will cause it to always evaluate to False. The condition should check if any of these are falsy (None or False), not if all of them are falsy. This should be:

if (
    not mc.ingress_profile or
    not mc.ingress_profile.application_load_balancer or
    not mc.ingress_profile.application_load_balancer.enabled
):

This matches the pattern used for web_application_routing above at lines 2700-2704.

Suggested change
not mc.ingress_profile and
not mc.ingress_profile.application_load_balancer and
not mc.ingress_profile or
not mc.ingress_profile.application_load_balancer or

Copilot uses AI. Check for mistakes.
not mc.ingress_profile.application_load_balancer.enabled
):
raise InvalidArgumentValueError(f'Addon "{addon}" is not enabled in this cluster.')
return {
"name": addon,
"api_key": addon_key,
"config": mc.ingress_profile.application_load_balancer,
}

# normal addons
if not mc.addon_profiles or addon_key not in mc.addon_profiles or not mc.addon_profiles[addon_key].enabled:
raise InvalidArgumentValueError(f'Addon "{addon}" is not enabled in this cluster.')
Expand Down Expand Up @@ -3098,6 +3122,11 @@ def _update_addons(cmd, # pylint: disable=too-many-branches,too-many-statements
resource_type=CUSTOM_MGMT_AKS_PREVIEW,
operation_group="managed_clusters",
)
ManagedClusterIngressProfileApplicationLoadBalancer = cmd.get_models(
"ManagedClusterIngressProfileApplicationLoadBalancer",
resource_type=CUSTOM_MGMT_AKS_PREVIEW,
operation_group="managed_clusters",
)
ManagedClusterIngressProfileWebAppRouting = cmd.get_models(
"ManagedClusterIngressProfileWebAppRouting",
resource_type=CUSTOM_MGMT_AKS_PREVIEW,
Expand All @@ -3113,6 +3142,16 @@ def _update_addons(cmd, # pylint: disable=too-many-branches,too-many-statements

# for each addons argument
for addon_arg in addon_args:
if addon_arg == "applicationloadbalancer":
# application load balancer routing settings are in ingress profile, not addon profile
if instance.ingress_profile is None:
instance.ingress_profile = ManagedClusterIngressProfile()
if instance.ingress_profile.application_load_balancer is None:
instance.ingress_profile.application_load_balancer = ManagedClusterIngressProfileApplicationLoadBalancer()
instance.ingress_profile.application_load_balancer.enabled = enable

continue

if addon_arg == "web_application_routing":
# web app routing settings are in ingress profile, not addon profile, so deal
# with it separately
Expand Down Expand Up @@ -4117,6 +4156,47 @@ def _aks_mesh_update(
return aks_update_decorator.update_mc(mc)


def aks_applicationloadbalancer_enable(
cmd,
client,
resource_group_name,
name
):
return _aks_applicationloadbalancer_update(
cmd,
client,
resource_group_name,
name,
enable_application_load_balancer=True)


def aks_applicationloadbalancer_disable(
cmd,
client,
resource_group_name,
name
):
return _aks_applicationloadbalancer_update(
cmd,
client,
resource_group_name,
name,
disable_application_load_balancer=True)


def aks_applicationloadbalancer_update(
cmd,
client,
resource_group_name,
name
):
return _aks_applicationloadbalancer_update(
cmd,
client,
resource_group_name,
name)


def aks_approuting_enable(
cmd,
client,
Expand Down Expand Up @@ -4249,6 +4329,36 @@ def aks_approuting_zone_list(
raise CLIError('App routing addon is not enabled')


# pylint: disable=unused-argument
def _aks_applicationloadbalancer_update(
cmd,
client,
resource_group_name,
name,
enable_application_load_balancer=None,
disable_application_load_balancer=None
):
from azure.cli.command_modules.acs._consts import DecoratorEarlyExitException
from azext_aks_preview.managed_cluster_decorator import AKSPreviewManagedClusterUpdateDecorator

raw_parameters = locals()

aks_update_decorator = AKSPreviewManagedClusterUpdateDecorator(
cmd=cmd,
client=client,
raw_parameters=raw_parameters,
resource_type=CUSTOM_MGMT_AKS_PREVIEW,
)

try:
mc = aks_update_decorator.fetch_mc()
mc = aks_update_decorator.update_application_load_balancer_profile(mc)
except DecoratorEarlyExitException:
return None

return aks_update_decorator.update_mc(mc)


# pylint: disable=unused-argument
def _aks_approuting_update(
cmd,
Expand Down
Loading
Loading