Skip to content

[AKS] Add mesh Istio CNI commands for az aks mesh#32992

Open
german1608 wants to merge 3 commits intoAzure:devfrom
german1608:feature/istio-cni-commands
Open

[AKS] Add mesh Istio CNI commands for az aks mesh#32992
german1608 wants to merge 3 commits intoAzure:devfrom
german1608:feature/istio-cni-commands

Conversation

@german1608
Copy link

Related command

  • az aks mesh enable-istio-cni
  • az aks mesh disable-istio-cni

Description

This PR adds az aks mesh enable-istio-cni and az aks mesh disable-istio-cni to enable and disable Istio CNI for the Istio-based service mesh add-on for AKS
Testing Guide


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

Add enable-istio-cni and disable-istio-cni commands under az aks mesh.

These commands allow users to toggle the proxy redirection mechanism
for Azure Service Mesh between CNI chaining (better security and
performance) and init containers (traditional method).

Changes:
- _consts.py: Add CONST_AZURE_SERVICE_MESH_PROXY_REDIRECTION_INIT_CONTAINERS
  and CONST_AZURE_SERVICE_MESH_PROXY_REDIRECTION_CNI_CHAINING constants
- _help.py: Add help text for enable-istio-cni and disable-istio-cni commands
- commands.py: Register the two new commands under aks mesh group
- custom.py: Add aks_mesh_enable_istio_cni() and aks_mesh_disable_istio_cni()
  functions and update _aks_mesh_update() signature
- managed_cluster_decorator.py: Add _handle_istio_cni_asm() method and wire
  it into update_azure_service_mesh_profile()
- test_managed_cluster_decorator.py: Add unit tests for _handle_istio_cni_asm
- test_aks_commands.py: Add live test for enable/disable Istio CNI
Copilot AI review requested due to automatic review settings March 20, 2026 03:03
@azure-client-tools-bot-prd
Copy link

azure-client-tools-bot-prd bot commented Mar 20, 2026

️✔️AzureCLI-FullTest
️✔️acr
️✔️latest
️✔️3.12
️✔️3.13
️✔️acs
️✔️latest
️✔️3.12
️✔️3.13
️✔️advisor
️✔️latest
️✔️3.12
️✔️3.13
️✔️ams
️✔️latest
️✔️3.12
️✔️3.13
️✔️apim
️✔️latest
️✔️3.12
️✔️3.13
️✔️appconfig
️✔️latest
️✔️3.12
️✔️3.13
️✔️appservice
️✔️latest
️✔️3.12
️✔️3.13
️✔️aro
️✔️latest
️✔️3.12
️✔️3.13
️✔️backup
️✔️latest
️✔️3.12
️✔️3.13
️✔️batch
️✔️latest
️✔️3.12
️✔️3.13
️✔️batchai
️✔️latest
️✔️3.12
️✔️3.13
️✔️billing
️✔️latest
️✔️3.12
️✔️3.13
️✔️botservice
️✔️latest
️✔️3.12
️✔️3.13
️✔️cdn
️✔️latest
️✔️3.12
️✔️3.13
️✔️cloud
️✔️latest
️✔️3.12
️✔️3.13
️✔️cognitiveservices
️✔️latest
️✔️3.12
️✔️3.13
️✔️compute_recommender
️✔️latest
️✔️3.12
️✔️3.13
️✔️computefleet
️✔️latest
️✔️3.12
️✔️3.13
️✔️config
️✔️latest
️✔️3.12
️✔️3.13
️✔️configure
️✔️latest
️✔️3.12
️✔️3.13
️✔️consumption
️✔️latest
️✔️3.12
️✔️3.13
️✔️container
️✔️latest
️✔️3.12
️✔️3.13
️✔️containerapp
️✔️latest
️✔️3.12
️✔️3.13
️✔️core
️✔️latest
️✔️3.12
️✔️3.13
️✔️cosmosdb
️✔️latest
️✔️3.12
️✔️3.13
️✔️databoxedge
️✔️latest
️✔️3.12
️✔️3.13
️✔️dls
️✔️latest
️✔️3.12
️✔️3.13
️✔️dms
️✔️latest
️✔️3.12
️✔️3.13
️✔️eventgrid
️✔️latest
️✔️3.12
️✔️3.13
️✔️eventhubs
️✔️latest
️✔️3.12
️✔️3.13
️✔️feedback
️✔️latest
️✔️3.12
️✔️3.13
️✔️find
️✔️latest
️✔️3.12
️✔️3.13
️✔️hdinsight
️✔️latest
️✔️3.12
️✔️3.13
️✔️identity
️✔️latest
️✔️3.12
️✔️3.13
️✔️iot
️✔️latest
️✔️3.12
️✔️3.13
️✔️keyvault
️✔️latest
️✔️3.12
️✔️3.13
️✔️lab
️✔️latest
️✔️3.12
️✔️3.13
️✔️managedservices
️✔️latest
️✔️3.12
️✔️3.13
️✔️maps
️✔️latest
️✔️3.12
️✔️3.13
️✔️marketplaceordering
️✔️latest
️✔️3.12
️✔️3.13
️✔️monitor
️✔️latest
️✔️3.12
️✔️3.13
️✔️mysql
️✔️latest
️✔️3.12
️✔️3.13
️✔️netappfiles
️✔️latest
️✔️3.12
️✔️3.13
️✔️network
️✔️latest
️✔️3.12
️✔️3.13
️✔️policyinsights
️✔️latest
️✔️3.12
️✔️3.13
️✔️postgresql
️✔️latest
️✔️3.12
️✔️3.13
️✔️privatedns
️✔️latest
️✔️3.12
️✔️3.13
️✔️profile
️✔️latest
️✔️3.12
️✔️3.13
️✔️rdbms
️✔️latest
️✔️3.12
️✔️3.13
️✔️redis
️✔️latest
️✔️3.12
️✔️3.13
️✔️relay
️✔️latest
️✔️3.12
️✔️3.13
️✔️resource
️✔️latest
️✔️3.12
️✔️3.13
️✔️role
️✔️latest
️✔️3.12
️✔️3.13
️✔️search
️✔️latest
️✔️3.12
️✔️3.13
️✔️security
️✔️latest
️✔️3.12
️✔️3.13
️✔️servicebus
️✔️latest
️✔️3.12
️✔️3.13
️✔️serviceconnector
️✔️latest
️✔️3.12
️✔️3.13
️✔️servicefabric
️✔️latest
️✔️3.12
️✔️3.13
️✔️signalr
️✔️latest
️✔️3.12
️✔️3.13
️✔️sql
️✔️latest
️✔️3.12
️✔️3.13
️✔️sqlvm
️✔️latest
️✔️3.12
️✔️3.13
️✔️storage
️✔️latest
️✔️3.12
️✔️3.13
️✔️synapse
️✔️latest
️✔️3.12
️✔️3.13
️✔️telemetry
️✔️latest
️✔️3.12
️✔️3.13
️✔️util
️✔️latest
️✔️3.12
️✔️3.13
️✔️vm
️✔️latest
️✔️3.12
️✔️3.13

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

azure-client-tools-bot-prd bot commented Mar 20, 2026

⚠️AzureCLI-BreakingChangeTest
⚠️acs
rule cmd_name rule_message suggest_message
⚠️ 1001 - CmdAdd aks mesh disable-istio-cni cmd aks mesh disable-istio-cni added
⚠️ 1001 - CmdAdd aks mesh enable-istio-cni cmd aks mesh enable-istio-cni added

@yonzhan
Copy link
Collaborator

yonzhan commented Mar 20, 2026

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

@github-actions
Copy link

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>

Copy link
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 first-class CLI support for toggling Istio CNI proxy redirection for the AKS Azure Service Mesh (Istio) add-on via new az aks mesh subcommands.

Changes:

  • Adds az aks mesh enable-istio-cni and az aks mesh disable-istio-cni commands wired through acs/custom.py and command table registration.
  • Implements service mesh profile mutation logic in managed_cluster_decorator.py to set proxy_redirection_mechanism to CNIChaining or InitContainers.
  • Adds unit + scenario coverage, updates help text, introduces constants, and records the feature in HISTORY.rst.

Reviewed changes

Copilot reviewed 8 out of 9 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
src/azure-cli/azure/cli/command_modules/acs/managed_cluster_decorator.py Adds _handle_istio_cni_asm and wires it into service mesh profile updates.
src/azure-cli/azure/cli/command_modules/acs/custom.py Adds aks_mesh_enable_istio_cni / aks_mesh_disable_istio_cni wrappers and threads new params into _aks_mesh_update.
src/azure-cli/azure/cli/command_modules/acs/commands.py Registers the two new aks mesh custom commands.
src/azure-cli/azure/cli/command_modules/acs/_help.py Adds help entries and examples for the new commands.
src/azure-cli/azure/cli/command_modules/acs/_consts.py Introduces constants for proxy redirection mechanism values.
src/azure-cli/azure/cli/command_modules/acs/tests/latest/test_managed_cluster_decorator.py Adds unit tests for _handle_istio_cni_asm behavior and error cases.
src/azure-cli/azure/cli/command_modules/acs/tests/latest/test_aks_commands.py Adds scenario test coverage for enable/disable Istio CNI end-to-end.
src/azure-cli/HISTORY.rst Adds release notes entries for the new commands.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +4936 to +4943
if enable_istio_cni:
new_profile.istio.components.proxy_redirection_mechanism = \
CONST_AZURE_SERVICE_MESH_PROXY_REDIRECTION_CNI_CHAINING
updated = True
elif disable_istio_cni:
new_profile.istio.components.proxy_redirection_mechanism = \
CONST_AZURE_SERVICE_MESH_PROXY_REDIRECTION_INIT_CONTAINERS
updated = True
Copy link

Copilot AI Mar 20, 2026

Choose a reason for hiding this comment

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

_handle_istio_cni_asm always sets updated = True when enable_istio_cni/disable_istio_cni is passed, even if proxy_redirection_mechanism is already at the requested value. This causes an unnecessary update_mc call (and likely an ARM PUT / LRO) for a no-op. Consider checking the current value first and only marking updated when the mechanism actually changes (or alternatively raising an ArgumentUsageError when the cluster is already in the desired state, similar to _handle_enable_disable_asm).

Suggested change
if enable_istio_cni:
new_profile.istio.components.proxy_redirection_mechanism = \
CONST_AZURE_SERVICE_MESH_PROXY_REDIRECTION_CNI_CHAINING
updated = True
elif disable_istio_cni:
new_profile.istio.components.proxy_redirection_mechanism = \
CONST_AZURE_SERVICE_MESH_PROXY_REDIRECTION_INIT_CONTAINERS
updated = True
# Only update when the proxy redirection mechanism actually changes
current_mechanism = getattr(
new_profile.istio.components,
"proxy_redirection_mechanism",
None,
)
if enable_istio_cni:
if current_mechanism != CONST_AZURE_SERVICE_MESH_PROXY_REDIRECTION_CNI_CHAINING:
new_profile.istio.components.proxy_redirection_mechanism = \
CONST_AZURE_SERVICE_MESH_PROXY_REDIRECTION_CNI_CHAINING
updated = True
elif disable_istio_cni:
if current_mechanism != CONST_AZURE_SERVICE_MESH_PROXY_REDIRECTION_INIT_CONTAINERS:
new_profile.istio.components.proxy_redirection_mechanism = \
CONST_AZURE_SERVICE_MESH_PROXY_REDIRECTION_INIT_CONTAINERS
updated = True

Copilot uses AI. Check for mistakes.
Copy link
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.

Queued live test to validate the change.

Comment on lines +11 to +12
* `az aks mesh enable-istio-cni`: Add command to enable Istio CNI chaining for Azure Service Mesh proxy redirection mechanism
* `az aks mesh disable-istio-cni`: Add command to disable Istio CNI chaining for Azure Service Mesh proxy redirection mechanism
Copy link
Member

@FumingZhang FumingZhang Mar 20, 2026

Choose a reason for hiding this comment

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

There’s no need to manually update the history note for changes to azure-cli. Please follow the instructions to update your PR title or description, as these will be used as release history notes.

@FumingZhang
Copy link
Member

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 3 pipeline(s).

…st entries

- managed_cluster_decorator.py: Check current proxy_redirection_mechanism
  before marking updated to avoid unnecessary ARM PUT calls (per Copilot review)
- HISTORY.rst: Remove manual history entries per @FumingZhang — PR title/description
  is used automatically for release notes
- test_managed_cluster_decorator.py: Add idempotency test cases for
  enable/disable when already at desired state
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

AKS az aks/acs/openshift Auto-Assign Auto assign by bot

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants