Skip to content

[AKS] az aks create and az aks nodepool add: Add --pod-ip-allocation-mode to the agentpool profile in AKS for Azure CNI Static Block GA feature support#31544

Merged
yanzhudd merged 16 commits intoAzure:devfrom
nairashu:asn/StaticBlockGA
Jun 24, 2025

Conversation

@nairashu
Copy link
Copy Markdown
Contributor

@nairashu nairashu commented May 23, 2025

[AKS] az aks create and az aks nodepool add: Add --pod-ip-allocation-mode to the agentpool profile in AKS for Azure CNI Static Block GA feature support

Related command
az aks create
az aks nodepool add

Description
Add Azure CNI Static Block related change from preview. Adding flags & validation to below commands

az aks create
az aks nodepool add
Azure CLI extension PR: Azure/azure-cli-extensions#7288

This property is added to the network profile of an Agentpool in AKS to describe the type of IPAM when using Azure CNI.

Testing Guide
az aks create <CLUSTER_NAME> --network-plugin azure --vnet-subnet-id <NODE_SUBNET_ID> --pod-subnet-id <POD_SUBNET_ID> --pod-ip-allocation-mode <"DynamicIndividual or StaticBlock"> --max-pods 80

az aks nodepool add <NODEPOOL_NAME> --pod-subnet-id <POD_SUBNET_ID> --pod-ip-allocation-mode <"DynamicIndividual or StaticBlock"> --max-pods 80

Example:

az aks create -n $(CLUSTER) -g $(GROUP) -l $(REGION) \
               --kubernetes-version $(K8S_VER) \
               --node-count $(NODE_COUNT) \
               --node-vm-size $(VM_SIZE) \
               --network-plugin azure \
               --network-dataplane cilium \
               --vnet-subnet-id /subscriptions/$(SUB)/resourceGroups/$(GROUP)/providers/Microsoft.Network/virtualNetworks/$(VNET)/subnets/nodenet \
               --pod-subnet-id /subscriptions/$(SUB)/resourceGroups/$(GROUP)/providers/Microsoft.Network/virtualNetworks/$(VNET)/subnets/podnet \
               --pod-ip-allocation-mode $(POD_IP_ALLOCATION_MODE) \
               --max-pods 80

History Notes
[AKS] az aks create: Add --pod-ip-allocation-mode parameter to support Azure CNI Static Block Allocation
[AKS] az aks nodepool add: Add --pod-ip-allocation-mode parameter to support Azure CNI Static Block Allocation


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

Copilot AI review requested due to automatic review settings May 23, 2025 05:41
@azure-client-tools-bot-prd
Copy link
Copy Markdown

azure-client-tools-bot-prd bot commented May 23, 2025

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

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

Hi @nairashu,
Since the current milestone time is less than 7 days, this pr will be reviewed in the next milestone.

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

azure-client-tools-bot-prd bot commented May 23, 2025

❌AzureCLI-BreakingChangeTest
❌acs
rule cmd_name rule_message suggest_message
1010 - ParaPropUpdate aks nodepool add cmd aks nodepool add update parameter spot_max_price: updated property default from nan to nan please change property default from nan to nan for parameter spot_max_price of cmd aks nodepool add
⚠️ 1006 - ParaAdd aks create cmd aks create added parameter pod_ip_allocation_mode
⚠️ 1006 - ParaAdd aks nodepool add cmd aks nodepool add added parameter pod_ip_allocation_mode

Please submit your Breaking Change Pre-announcement ASAP if you haven't already. Please note:

  • Breaking changes can only be merged during the designated breaking change window
  • A pre-announcement must be released at least one month in advance

For more details on how to introduce breaking changes, refer to the documentation: azure-cli/doc/how_to_introduce_breaking_changes.md

@yonzhan
Copy link
Copy Markdown
Collaborator

yonzhan commented May 23, 2025

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

@github-actions
Copy link
Copy Markdown

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

Adds support for the new --pod-ip-allocation-mode flag to both az aks create and az aks nodepool add, enabling Azure CNI Static Block GA scenarios.

  • Introduces the pod_ip_allocation_mode parameter in command signatures, validators, and parameter loading.
  • Extends the agentpool decorator to get and set pod_ip_allocation_mode on the AgentPool profile.
  • Adds constants, help documentation, and tests covering DynamicIndividual and StaticBlock modes.

Reviewed Changes

Copilot reviewed 9 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/_consts.py Added constants for pod IP allocation modes.
src/azure-cli/azure/cli/command_modules/acs/_validators.py Implemented validate_pod_ip_allocation_mode.
src/azure-cli/azure/cli/command_modules/acs/_params.py Registered the new argument with enum type and validator.
src/azure-cli/azure/cli/command_modules/acs/_help.py Added help entries and examples for the new flag.
src/azure-cli/azure/cli/command_modules/acs/custom.py Updated aks_create and aks_agentpool_add to accept the parameter.
src/azure-cli/azure/cli/command_modules/acs/agentpool_decorator.py Extended context and decorator to handle the new flag.
Tests in test_managed_cluster_decorator.py, test_aks_commands.py, and test_agentpool_decorator.py Added assertions and a full create flow for StaticBlock mode.
Comments suppressed due to low confidence (2)

src/azure-cli/azure/cli/command_modules/acs/agentpool_decorator.py:780

  • The logic inverts the intended fallback: you override only when pod_ip_allocation_mode is truthy. It should instead use the agentpool value only when the raw parameter is not provided (e.g., if pod_ip_allocation_mode is None and self.agentpool and ...).
if (pod_ip_allocation_mode and self.agentpool and self.agentpool.pod_ip_allocation_mode is not None):

src/azure-cli/azure/cli/command_modules/acs/agentpool_decorator.py:766

  • The method signature incorrectly annotates self as bool = False; it should be def get_pod_ip_allocation_mode(self) -> Union[str, None]: to match other context getters.
def get_pod_ip_allocation_mode(self: bool = False) -> Union[str, None]:

Comment thread src/azure-cli/azure/cli/command_modules/acs/_help.py
@FumingZhang
Copy link
Copy Markdown
Member

/azp run

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 3 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

Queued live test to validate the change.

  • test_aks_create_with_pod_ip_allocation_mode_static_block

@FumingZhang
Copy link
Copy Markdown
Member

FumingZhang commented May 23, 2025

depends on 2025-04-01 API version, updated milestone to https://github.com/Azure/azure-cli/milestone/157

@nairashu
Copy link
Copy Markdown
Contributor Author

nairashu commented Jun 3, 2025

/azp run

@azure-pipelines
Copy link
Copy Markdown

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

@yonzhan
Copy link
Copy Markdown
Collaborator

yonzhan commented Jun 3, 2025

/azp run

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 3 pipeline(s).

@FumingZhang
Copy link
Copy Markdown
Member

/azp run

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 3 pipeline(s).

@nairashu nairashu force-pushed the asn/StaticBlockGA branch from 8dd699d to 14dfc78 Compare June 10, 2025 18:33
@nairashu
Copy link
Copy Markdown
Contributor Author

/azp run

@azure-pipelines
Copy link
Copy Markdown

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

@yanzhudd
Copy link
Copy Markdown
Contributor

/azp run

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 3 pipeline(s).

Comment thread src/azure-cli/azure/cli/command_modules/acs/tests/latest/test_aks_commands.py Outdated
Comment thread src/azure-cli/azure/cli/command_modules/acs/agentpool_decorator.py
Comment thread src/azure-cli/azure/cli/command_modules/acs/agentpool_decorator.py
Comment thread src/azure-cli/azure/cli/command_modules/acs/_params.py Outdated
@FumingZhang
Copy link
Copy Markdown
Member

Queued live test to validate the change. If the test passed, you could find the new recording file from the pipeline artifact.

  • test_aks_create_with_pod_ip_allocation_mode_static_block

Comment thread src/azure-cli/azure/cli/command_modules/acs/_help.py Outdated
Comment thread src/azure-cli/azure/cli/command_modules/acs/_help.py Outdated
nairashu and others added 2 commits June 23, 2025 19:13
Co-authored-by: Xing Zhou <Zhou.Xing@microsoft.com>
@nairashu
Copy link
Copy Markdown
Contributor Author

@zhoxing-ms : I believe there is still time for the cut-off and I am trying my best to get this in the July milestone. This feature GA is to be announced on 6/30.

@zhoxing-ms
Copy link
Copy Markdown
Contributor

Sorry, I'm very busy this morning. @yanzhudd Please help me keep an eye on this PR and make it merged as smooth as possible in this sprint

zhoxing-ms
zhoxing-ms previously approved these changes Jun 24, 2025
@nairashu
Copy link
Copy Markdown
Contributor Author

@yanzhudd : Could you trigger the pipelines once more.

@zhoxing-ms
Copy link
Copy Markdown
Contributor

/azp run

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 3 pipeline(s).

zhoxing-ms
zhoxing-ms previously approved these changes Jun 24, 2025
Co-authored-by: FumingZhang <81607949+FumingZhang@users.noreply.github.com>
@FumingZhang
Copy link
Copy Markdown
Member

/azp run

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 3 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.

@yanzhudd yanzhudd merged commit 079bca2 into Azure:dev Jun 24, 2025
48 checks passed
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.

7 participants