Skip to content

[AKS] az aks nodepool: Add --use-patch-api for vms agentpool scale - #10468

Merged
JaysonTaiMicrosoft merged 2 commits into
Azure:mainfrom
HuShaoRu:patch-vms-ap
Oct 15, 2026
Merged

JaysonTaiMicrosoft merged 2 commits into
Azure:mainfrom
HuShaoRu:patch-vms-ap

Conversation

@HuShaoRu

@HuShaoRu Shaoru Hu (HuShaoRu) commented Oct 13, 2026 •

Copy link
Copy Markdown
Contributor

🤖 PR Validation — ⚠️ Review suggested

Breaking Changes
⚠️ None
⚠️Azure CLI Extensions Breaking Change Test
⚠️aks-preview
rule cmd_name rule_message suggest_message
⚠️ 1006 - ParaAdd aks nodepool manual-scale add cmd aks nodepool manual-scale add added parameter use_patch_api
⚠️ 1006 - ParaAdd aks nodepool manual-scale delete cmd aks nodepool manual-scale delete added parameter use_patch_api
⚠️ 1006 - ParaAdd aks nodepool manual-scale update cmd aks nodepool manual-scale update added parameter use_patch_api

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

Related command

az aks nodepool scale --use-patch-api
az aks nodepool manual-scale --use-patch-api

add a new bool parameter --use-patch-api, so vms pool scale can use patch api instead of put api. (this parameter is already supported for vmss pool)

General Guidelines

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

For new extensions:

About Extension Publish

There is a pipeline to automatically build, upload and publish extension wheels.
Once your pull request is merged into main branch, a new pull request will be created to update src/index.json automatically.
You only need to update the version information in file setup.py and historical information in file HISTORY.rst in your PR but do not modify src/index.json.

Copilot AI balanced review requested due to automatic review settings October 13, 2026 20:14
@microsoft-github-policy-service microsoft-github-policy-service Bot added the customer-reported Issues that are reported by GitHub users external to the Azure organization. label Oct 13, 2026
@microsoft-github-policy-service

Copy link
Copy Markdown
Contributor

Thank you for your contribution Shaoru Hu (@HuShaoRu)! We will review the pull request and get back to you soon.

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.

🟡 Changes recommended

PATCH routing and help text unintentionally include untested AvailabilitySet and FlexNodes pools.

2 open findings
What changed in this PR

Extends PATCH-based AKS node-pool scaling to VirtualMachines pools and manual-scale operations.

Changes:

  • Adds --use-patch-api to manual-scale commands.
  • Builds VirtualMachines PATCH payloads.
  • Adds integration tests and recordings.
File Description
HISTORY.rst Documents PATCH support.
test_aks_commands.py Tests VMSS and VirtualMachines scaling.
test_aks_nodepool_scale_vmss_with_patch_api.yaml Records VMSS PATCH behavior.
custom.py Implements PATCH payloads and routing.
_params.py Registers and documents the option.

🧠 Review effort: Balanced


💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread src/aks-preview/azext_aks_preview/custom.py
Comment thread src/aks-preview/azext_aks_preview/_params.py
@yonzhan

Copy link
Copy Markdown
Collaborator

/azp run

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 2 pipeline(s).

@JaysonTaiMicrosoft JaysonTaiMicrosoft added the Request X Engineering Agent Ask the agent to triage this issue or review this PR label Oct 14, 2026
@x-engineering-agent

x-engineering-agent Bot commented Oct 14, 2026 •

Copy link
Copy Markdown

X Engineering Agent Report

Review — Comments

Shaoru Hu (@HuShaoRu)

Review

The completed upstream CI snapshot has no failures. One scope regression remains in PATCH routing; the default PUT path should stay unchanged for pool types outside this feature.

Scope-consistency finding

PR-related: src/aks-preview/azext_aks_preview/custom.py:2503 changes the VMSS-only guard to if use_patch_api. This now routes AvailabilitySet and FlexNodes pools through _aks_agentpool_scale_patch, whose non-VirtualMachines branch sends a count-only PATCH. Previously those types retained begin_create_or_update even with the flag. The description and added scenarios establish VMSS/VirtualMachines support, not this additional behavior change. This confirms Copilot discussion 4263658830; the broadened help at _params.py:2839 has the same scope problem (4263658905).

Restrict PATCH dispatch to CONST_VIRTUAL_MACHINE_SCALE_SETS and CONST_VIRTUAL_MACHINES, preserve the prior PUT fallback for other types, and name those supported types in the flag help. Verify both supported types call begin_update, while AvailabilitySet/FlexNodes retain the prior PUT path with the flag enabled. Rerun the three focused scenarios below after the routing correction.

Test validation

  • Agent live test: Not run; this is a review-only PR. Check author-provided test evidence and upstream CI separately.
  • Regression coverage: Not applicable to the changed files.

The changed src/aks-preview/azext_aks_preview/tests/latest/test_aks_commands.py scenarios cover VMSS scaling, VirtualMachines scale up/down, and adding/updating/deleting a second manual profile. Matching recordings are included at tests/latest/recordings/test_aks_nodepool_scale_vmss_with_patch_api.yaml, test_aks_nodepool_scale_vms_with_patch_api.yaml, and test_aks_nodepool_manual_scale_update_with_patch_api.yaml beneath that extension. These are author-provided artifacts, not Agent live-test results. The automatic coverage result above does not verify extension scenario coverage; the newly expanded AvailabilitySet/FlexNodes dispatch has no focused assertion. Validate the routing guard with mocked PUT/PATCH calls and rerun test_aks_nodepool_scale_vmss_with_patch_api, test_aks_nodepool_scale_vms_with_patch_api, and test_aks_nodepool_manual_scale_update_with_patch_api in the extension's scenario file.

Risk assessment

31/100 · Medium · High confidence

The Medium rating is driven by public CLI behavior.

  • Change scope: 7 changed files, 4880 changed lines (+4869 / -11), including 2 production files.
  • Affected components: aks-preview
  • Risk drivers: public CLI behavior (+18)
  • Regression evidence: Changed regression tests are included, reducing risk.
  • Confidence: High because changed-line patches were available for every production file.
  • Required review: Owning-squad review is recommended for aks-preview before merge.

Posted by x-engineering-agent (Reviewer)

@x-engineering-agent x-engineering-agent Bot added the X Engineering Agent Reviewed Agent reviewed this PR label Oct 15, 2026
@JaysonTaiMicrosoft
JaysonTaiMicrosoft merged commit 6cc2ff3 into Azure:main Oct 15, 2026
36 checks passed
@JaysonTaiMicrosoft JaysonTaiMicrosoft changed the title {AKS} add --use-patch-api for vms agentpool scale [AKS] az aks nodepool: Add --use-patch-api for vms agentpool scale Oct 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

customer-reported Issues that are reported by GitHub users external to the Azure organization. Request X Engineering Agent Ask the agent to triage this issue or review this PR X Engineering Agent Reviewed Agent reviewed this PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants