Skip to content

[AKS] az aks nodepool upgrade: Fix --max-unavailable being silently ignored - #33215

Merged
Julie Zhu (yanzhudd) merged 2 commits into
Azure:devfrom
Jenniferyingni:fix/nodepool-upgrade-max-unavailable
Jun 2, 2026
Merged

Julie Zhu (yanzhudd) merged 2 commits into
Azure:devfrom
Jenniferyingni:fix/nodepool-upgrade-max-unavailable

Conversation

@Jenniferyingni

@Jenniferyingni Jenniferyingni commented Apr 17, 2026

Copy link
Copy Markdown
Member
  • Fix az aks nodepool upgrade --max-unavailable being silently ignored
  • The --max-unavailable parameter was accepted and validated but never assigned to the agent pool's upgrade_settings before the PUT request
  • Added the missing assignment: instance.upgrade_settings.max_unavailable = max_unavailable

Fixes #33195

Related command

Description

Testing Guide
Run "az aks nodepool upgrade --max-unavailable " and verify the value is applied

History Notes


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

…ignored

The `--max-unavailable` flag was accepted but never applied to the agent
pool upgrade settings before the PUT request, causing it to be silently
dropped. Add the missing assignment.

Fixes Azure#33195

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@azure-client-tools-bot-prd

azure-client-tools-bot-prd Bot commented Apr 17, 2026

Copy link
Copy Markdown
️✔️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

azure-client-tools-bot-prd Bot commented Apr 17, 2026

Copy link
Copy Markdown
️✔️AzureCLI-BreakingChangeTest
️✔️Non Breaking Changes

@yonzhan

Copy link
Copy Markdown
Collaborator

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>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Fixes az aks nodepool upgrade --max-unavailable being accepted/validated but not applied to the AgentPool PUT payload, so the setting was silently dropped.

Changes:

  • Assign max_unavailable into instance.upgrade_settings.max_unavailable during nodepool upgrade.

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

Comment thread src/azure-cli/azure/cli/command_modules/acs/custom.py
@FumingZhang

Copy link
Copy Markdown
Member

/azp run

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines successfully started running 3 pipeline(s).

@FumingZhang FumingZhang left a comment

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.

lgtm, could you add a unit test case for the change? Also, please remember to update the PR title so it passes the CI checks.

@Jenniferyingni Jenniferyingni changed the title [AKS] Fix az aks nodepool upgrade --max-unavailable being silently ignored [AKS] Fix az aks nodepool upgrade --max-unavailable being silently ignored May 4, 2026
@Jenniferyingni Jenniferyingni changed the title [AKS] Fix az aks nodepool upgrade --max-unavailable being silently ignored [AKS] Fix nodepool upgrade --max-unavailable being silently ignored May 4, 2026
@Jenniferyingni Jenniferyingni changed the title [AKS] Fix nodepool upgrade --max-unavailable being silently ignored [AKS] Fix az aks nodepool upgrade --max-unavailable being silently ignored May 4, 2026

@a0x1ab Aditya Pujara (a0x1ab) left a comment

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.

🤖 AI Agent | Automated Quality Gate

✅ Test Results — Issue #33195 / PR #33215

Test environment: Local unit test run on PR branch fix/nodepool-upgrade-max-unavailable

Test Suite Result
test_custom.py::AksAgentpoolUpgradeTest::test_aks_agentpool_upgrade_sets_max_unavailable ✅ PASSED
test_custom.py (full suite) ✅ 38 passed, 1 skipped

Validation: The new test confirms that max_unavailable is correctly assigned to instance.upgrade_settings.max_unavailable during aks_agentpool_upgrade(). The silent-drop bug is fixed.

Minor observation (non-blocking): The condition if max_unavailable: is consistent with how max_surge is handled in the same function and is fine for string CLI args (e.g. "0%" or "1" are truthy). No change needed.

No regressions detected.

Note: Azure VM provisioning was unavailable in this environment; live E2E tests against a real AKS cluster could not be run. Unit test coverage of the changed code path is complete.>

@a0x1ab Aditya Pujara (a0x1ab) left a comment

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.

Review: PR #33215 — Fix az aks nodepool upgrade --max-unavailable being silently ignored

✅ CI Checks — All Passed

Check Result
license/cla ✅ success
azdev-linter ✅ success
azdev-style ✅ success

🔍 Code Review

Fix in custom.py (correct):
The root cause was that max_unavailable was accepted and validated but never assigned to instance.upgrade_settings before the PUT request. The one-line fix is minimal, targeted, and follows the exact same guard pattern (if param:) used by the adjacent node_soak_duration and undrainable_node_behavior assignments.

Test in test_custom.py (adequate):
AksAgentpoolUpgradeTest.test_aks_agentpool_upgrade_sets_max_unavailable correctly:

  • Constructs a real AgentPoolUpgradeSettings object (not a plain mock) so the attribute assignment is meaningful.
  • Mocks client.get and sdk_no_wait to avoid network calls.
  • Asserts instance.upgrade_settings.max_unavailable == 5 directly after the call.

Minor note (non-blocking): if max_unavailable: will skip assignment when the value is integer 0. In practice --max-unavailable is always passed as a string (e.g. 0, 33%), so this is consistent with the rest of the function and is not a regression.

🧪 Live Tests

Live-test workflow on Azure/issue-sentinel was not reachable (workflow not found). Unit test coverage is sufficient for this change given its simplicity.

✅ Verdict

The fix is correct, minimal, consistent with surrounding code, and well-tested. No changes requested. Ready for human maintainer review.


Posted by agent-assist (autonomous bug-fix pipeline).

@FumingZhang

Copy link
Copy Markdown
Member

/azp run

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines successfully started running 3 pipeline(s).

@FumingZhang

Copy link
Copy Markdown
Member

Jenniferyingni please fix failed CI check

@Jenniferyingni Jenniferyingni changed the title [AKS] Fix az aks nodepool upgrade --max-unavailable being silently ignored [AKS] Fix az aks nodepool upgrade --max-unavailable`` being silently ignored May 20, 2026
@Jenniferyingni Jenniferyingni changed the title [AKS] Fix az aks nodepool upgrade --max-unavailable`` being silently ignored [AKS] Fix "az aks nodepool upgrade --max-unavailable" being silently ignored May 20, 2026
@Jenniferyingni

Copy link
Copy Markdown
Member Author

/azp run

@azure-pipelines

Copy link
Copy Markdown
Commenter does not have sufficient privileges for PR 33215 in repo Azure/azure-cli

@Jenniferyingni

Jenniferyingni commented May 20, 2026

Copy link
Copy Markdown
Member Author

FumingZhang fixed the PR title, please rerun the command, thanks!

@FumingZhang

Copy link
Copy Markdown
Member

/azp run

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines successfully started running 3 pipeline(s).

@yanzhudd Julie Zhu (yanzhudd) changed the title [AKS] Fix "az aks nodepool upgrade --max-unavailable" being silently ignored [AKS] az aks nodepool upgrade: Fix --max-unavailable being silently ignored May 26, 2026
@yanzhudd

Copy link
Copy Markdown
Contributor

/azp run

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines successfully started running 3 pipeline(s).

@yanzhudd
Julie Zhu (yanzhudd) merged commit d7d1701 into Azure:dev Jun 2, 2026
50 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

az aks nodepool upgrade silently drops --max-unavailable flag

7 participants