Skip to content

Application Gateway for Containers addon commands#9387

Merged
zhoxing-ms merged 25 commits intoAzure:mainfrom
JackStromberg:agc-addon
Dec 22, 2025
Merged

Application Gateway for Containers addon commands#9387
zhoxing-ms merged 25 commits intoAzure:mainfrom
JackStromberg:agc-addon

Conversation

@JackStromberg
Copy link
Copy Markdown
Member


This checklist is used to make sure that common guidelines for a pull request are followed.

Related command

  • 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.

General Guidelines

  • [yes] Have you run azdev style <YOUR_EXT> locally? (pip install azdev required)
  • [yes] Have you run python scripts/ci/test_index.py -q locally? (pip install wheel==0.30.0 required)
  • [yes] My extension version conforms to the Extension version schema

Copilot AI review requested due to automatic review settings November 4, 2025 08:05
@azure-client-tools-bot-prd
Copy link
Copy Markdown

azure-client-tools-bot-prd bot commented Nov 4, 2025

⚠️Azure CLI Extensions Breaking Change Test
⚠️aks-preview
rule cmd_name rule_message suggest_message
⚠️ 1011 - SubgroupAdd aks applicationloadbalancer sub group aks applicationloadbalancer added
⚠️ 1006 - ParaAdd aks create cmd aks create added parameter enable_application_load_balancer
⚠️ 1006 - ParaAdd aks update cmd aks update added parameter disable_application_load_balancer
⚠️ 1006 - ParaAdd aks update cmd aks update added parameter enable_application_load_balancer

@azure-client-tools-bot-prd
Copy link
Copy Markdown

Hi @JackStromberg,
Please write the description of changes which can be perceived by customers into HISTORY.rst.
If you want to release a new extension version, please update the version in setup.py as well.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Nov 4, 2025

The git hooks are available for azure-cli and azure-cli-extensions repos. They could help you run required checks before creating the PR.

Please sync the latest code with latest dev branch (for azure-cli) or main branch (for azure-cli-extensions).
After that please run the following commands to enable git hooks:

pip install azdev --upgrade
azdev setup -c <your azure-cli repo path> -r <your azure-cli-extensions repo path>

@yonzhan
Copy link
Copy Markdown
Collaborator

yonzhan commented Nov 4, 2025

Thank you for your contribution! We will review the pull request and get back to you soon.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Nov 4, 2025

Hi @JackStromberg

Release Suggestions

Module: aks-preview

  • Update VERSION to 19.0.0b18 in src/aks-preview/setup.py

Notes

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR adds support for the Application Load Balancer (Application Gateway for Containers) addon to AKS clusters. The implementation follows the pattern established for other special addons like web app routing.

Key changes:

  • Adds new CLI commands az aks applicationloadbalancer enable/disable/update for managing the addon
  • Integrates the addon into existing addon management infrastructure (aks addon enable/disable)
  • Stores configuration in the cluster's ingress profile rather than the standard addon profile

Reviewed Changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
managed_cluster_decorator.py Adds getter method for the parameter and methods to set up and update the application load balancer profile in the ingress profile
custom.py Implements the enable/disable/update commands and integrates with existing addon list/show/enable/disable functionality
commands.py Registers the new aks applicationloadbalancer command group with enable, disable, and update commands
addonconfiguration.py Adds handling for the applicationloadbalancer addon in the update_addons function
_help.py Adds documentation for the new commands and updates addon descriptions; fixes typo in app routing help
_consts.py Defines constants for the new addon name and adds it to the ADDONS dictionary and descriptions
HISTORY.rst Documents the new feature in the pending release notes

Comment thread src/aks-preview/azext_aks_preview/custom.py
Comment thread src/aks-preview/azext_aks_preview/managed_cluster_decorator.py Outdated
Comment thread src/aks-preview/HISTORY.rst Outdated
JackStromberg and others added 2 commits November 4, 2025 00:17
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Copy link
Copy Markdown
Member

@FumingZhang FumingZhang left a comment

Choose a reason for hiding this comment

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

Could you please add a new scenario test case (may refer to existing examples from test_aks_commands.py) for the change?

name_prefix="clitest",
location="westus2",
)
def test_aks_applicationloadbalancer_enable_disable(
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Queued live test against staging-westus2.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Queued live test again

@github-actions
Copy link
Copy Markdown
Contributor

CodeGen Tools Feedback Collection

Thank you for using our CodeGen tool. We value your feedback, and we would like to know how we can improve our product. Please take a few minutes to fill our codegen survey

@FumingZhang
Copy link
Copy Markdown
Member

/azp run

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 10 out of 11 changed files in this pull request and generated 9 comments.

Comment on lines +2715 to +2716
not mc.ingress_profile and
not mc.ingress_profile.application_load_balancer and
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.
Comment thread src/aks-preview/azext_aks_preview/tests/latest/test_aks_commands.py Outdated
Comment thread src/aks-preview/azext_aks_preview/tests/latest/test_aks_commands.py Outdated
Comment thread src/aks-preview/azext_aks_preview/custom.py Outdated
Comment on lines +4171 to +4182
def aks_applicationloadbalancer_disable(
cmd,
client,
resource_group_name,
name
):
return _aks_applicationloadbalancer_update(
cmd,
client,
resource_group_name,
name,
enable_application_load_balancer=False)
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 aks_applicationloadbalancer_disable function should pass disable_application_load_balancer=True instead of enable_application_load_balancer=False. The decorator's update_application_load_balancer_profile method checks for both enable_application_load_balancer and disable_application_load_balancer parameters separately (lines 6654-6655 in managed_cluster_decorator.py). Setting enable_application_load_balancer=False would result in no operation being performed. This is also related to the missing disable_application_load_balancer parameter in the _aks_applicationloadbalancer_update function signature.

Copilot uses AI. Check for mistakes.
Comment on lines +18691 to +18738
def test_aks_applicationloadbalancer_enable_disable(
self, resource_group, resource_group_location
):
"""This test case exercises enabling and disabling application load balancer (Application Gateway for Containers) in an AKS cluster."""

# reset the count so in replay mode the random names will start with 0
self.test_resources_count = 0

# create cluster without application load balancer
aks_name = self.create_random_name("cliakstest", 16)
node_vm_size = "standard_d4_v5"
self.kwargs.update(
{
"resource_group": resource_group,
"aks_name": aks_name,
"location": resource_group_location,
"ssh_key_value": self.generate_ssh_keys(),
}
)
create_cmd = (
"aks create --resource-group={resource_group} --name={aks_name} --location={location} "
"--enable-oidc-issuer "
"--enable-workload-identity "
"--enable-gateway-api "
"--enable-application-load-balancer "
"--ssh-key-value={ssh_key_value}"
)
self.cmd(
create_cmd,
checks=[
self.check("provisioningState", "Succeeded"),
self.check("ingressProfile.applicationLoadBalancer.enabled", True)
],
)

# disable application load balancer
disable_applicationloadbalancer_cmd = "aks update --resource-group={resource_group} --name={aks_name} --disable-application-load-balancer --disable-gateway-api"
self.cmd(
disable_applicationloadbalancer_cmd,
checks=[
self.check("provisioningState", "Succeeded"),
self.check("ingressProfile.applicationLoadBalancer.enabled", False),
],
)

# delete cluster
delete_cmd = "aks delete --resource-group={resource_group} --name={aks_name} --yes --no-wait"
self.cmd(delete_cmd, checks=[self.is_empty()])
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 test named test_aks_applicationloadbalancer_enable_disable does not test the dedicated az aks applicationloadbalancer enable and az aks applicationloadbalancer disable commands. It only tests aks update with the --disable-application-load-balancer flag. Consider adding test coverage for the dedicated commands introduced in this PR (aks applicationloadbalancer enable and aks applicationloadbalancer disable).

Copilot uses AI. Check for mistakes.
Comment thread src/aks-preview/azext_aks_preview/tests/latest/test_aks_commands.py Outdated
Comment thread src/aks-preview/azext_aks_preview/tests/latest/test_aks_commands.py Outdated
Comment thread src/aks-preview/azext_aks_preview/tests/latest/test_aks_commands.py Outdated
JackStromberg and others added 7 commits December 12, 2025 07:33
…ds.py

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…ds.py

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…ds.py

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…ds.py

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…ds.py

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@FumingZhang
Copy link
Copy Markdown
Member

/azp run

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 2 pipeline(s).

@FumingZhang
Copy link
Copy Markdown
Member

Please fix failed CI checks, you'll need to update the recording file as the code uses a new API version 2025-10-02-preview instead of 2025-09-02-preview now

except CannotOverwriteExistingCassetteException as ex:

      raise AssertionError(ex)

E AssertionError: Can't overwrite existing cassette ('/mnt/vss/_work/1/s/src/aks-preview/azext_aks_preview/tests/latest/recordings/test_aks_applicationloadbalancer_enable_disable.yaml') in your current record mode ('once').
E No match for the request (<Request (PUT) https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest000001/providers/Microsoft.ContainerService/managedClusters/cliakstest000001?api-version=2025-10-02-preview>) was found.
E Found 2 similar requests with 1 different matcher(s) :
E
E 1 - (<Request (PUT) https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest000001/providers/Microsoft.ContainerService/managedClusters/cliakstest000001?api-version=2025-09-02-preview>)..)
E Matchers succeeded : ['method', 'scheme', 'host', 'port', 'path']
E Matchers failed :
E _custom_request_query_matcher - assertion failure :
E None
E
E 2 - (<Request (PUT) https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest000001/providers/Microsoft.ContainerService/managedClusters/cliakstest000001?api-version=2025-09-02-preview>)..)
E Matchers succeeded : ['method', 'scheme', 'host', 'port', 'path']
E Matchers failed :
E _custom_request_query_matcher - assertion failure :
E None

@JackStromberg
Copy link
Copy Markdown
Member Author

/azp run

@azure-pipelines
Copy link
Copy Markdown

Commenter does not have sufficient privileges for PR 9387 in repo Azure/azure-cli-extensions

@FumingZhang
Copy link
Copy Markdown
Member

/azp run

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 2 pipeline(s).

Copy link
Copy Markdown
Member

@FumingZhang FumingZhang left a comment

Choose a reason for hiding this comment

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

LGTM

@yanzhudd
Copy link
Copy Markdown
Contributor

/azp run

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 2 pipeline(s).

@FumingZhang
Copy link
Copy Markdown
Member

/azp run

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 2 pipeline(s).

@zhoxing-ms zhoxing-ms merged commit 37f839c into Azure:main Dec 22, 2025
24 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

AKS Auto-Assign Auto assign by bot

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants