Skip to content

az aks nodepool update supports crg id#9811

Open
zjpjack-github wants to merge 3 commits intoAzure:mainfrom
zjpjack-github:jizen/crg_update
Open

az aks nodepool update supports crg id#9811
zjpjack-github wants to merge 3 commits intoAzure:mainfrom
zjpjack-github:jizen/crg_update

Conversation

@zjpjack-github
Copy link
Copy Markdown
Contributor


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

Related command

az aks nodepool update --crg-id

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 wheel==0.30.0 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 review requested due to automatic review settings April 22, 2026 00:01
@azure-client-tools-bot-prd
Copy link
Copy Markdown

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

⚠️Azure CLI Extensions Breaking Change Test
⚠️aks-preview
rule cmd_name rule_message suggest_message
⚠️ 1006 - ParaAdd aks nodepool update cmd aks nodepool update added parameter crg_id

@yonzhan
Copy link
Copy Markdown
Collaborator

yonzhan commented Apr 22, 2026

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

@github-actions
Copy link
Copy Markdown
Contributor

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>

@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

@github-actions
Copy link
Copy Markdown
Contributor

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 preview support in the aks-preview extension for associating an existing AKS nodepool with a Capacity Reservation Group via az aks nodepool update --crg-id, along with the required CLI surface updates and a version bump.

Changes:

  • Add --crg-id argument wiring for aks nodepool update and pass it through the nodepool update decorator pipeline.
  • Update command help/examples and bump extension version/release notes to 20.0.0b4.
  • Introduce an update_crg step during nodepool update to set capacity_reservation_group_id on the outgoing AgentPool model.

Reviewed changes

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

Show a summary per file
File Description
src/aks-preview/setup.py Bumps extension version to 20.0.0b4.
src/aks-preview/azext_aks_preview/custom.py Adds crg_id parameter to aks_agentpool_update signature so it flows into raw_parameters.
src/aks-preview/azext_aks_preview/agentpool_decorator.py Adds update_crg and calls it from the nodepool update flow.
src/aks-preview/azext_aks_preview/_params.py Adds crg_id argument (validator + preview) to aks nodepool update.
src/aks-preview/azext_aks_preview/_help.py Documents --crg-id and adds an example invocation.
src/aks-preview/README.rst Updates “released version” table to reflect 20.0.0b4.
src/aks-preview/HISTORY.rst Adds 20.0.0b4 release notes entry (but removes Pending section).

"""
self._ensure_agentpool(agentpool)

agentpool.capacity_reservation_group_id = self.context.get_crg_id()
Copy link

Copilot AI Apr 22, 2026

Choose a reason for hiding this comment

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

update_crg uses self.context.get_crg_id(), which currently prefers agentpool.capacity_reservation_group_id over the user-provided --crg-id once an agentpool is attached. This means az aks nodepool update --crg-id <newId> will be ignored when the nodepool already has a CRG ID set. Consider reading crg_id directly from context.raw_param (and only applying it when explicitly provided) so the update honors the CLI argument.

Suggested change
agentpool.capacity_reservation_group_id = self.context.get_crg_id()
if "crg_id" in self.context.raw_param:
agentpool.capacity_reservation_group_id = self.context.raw_param.get("crg_id")

Copilot uses AI. Check for mistakes.
agentpool.enable_fips = False

return agentpool

Copy link

Copilot AI Apr 22, 2026

Choose a reason for hiding this comment

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

There appears to be trailing whitespace on the blank line before update_crg (it shows spaces on an otherwise empty line). Please remove the whitespace to avoid lint/style issues.

Suggested change

Copilot uses AI. Check for mistakes.
Comment on lines +2063 to +2065
# update crg id
agentpool = self.update_crg(agentpool)

Copy link

Copilot AI Apr 22, 2026

Choose a reason for hiding this comment

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

New --crg-id behavior is introduced by calling update_crg from the update pipeline, but there’s no unit test asserting that providing --crg-id actually results in capacity_reservation_group_id being updated on the outgoing AgentPool object. Since this decorator already has dedicated unit tests, please add a test case covering the update scenario (including when an existing CRG ID is present).

Copilot uses AI. Check for mistakes.
short-summary: Whether to install driver for GPU node pool. Possible values are "Install" or "None".
- name: --crg-id
type: string
short-summary: The crg-id used to associate the existing nodepool with the existing Capacity Reservation Group resource.
Copy link

Copilot AI Apr 22, 2026

Choose a reason for hiding this comment

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

The help text uses “crg-id” in prose; for clarity and consistency with the flag name, consider referring to it as “CRG ID” (Capacity Reservation Group ID). Also consider expanding “CRG” on first use in the short summary.

Suggested change
short-summary: The crg-id used to associate the existing nodepool with the existing Capacity Reservation Group resource.
short-summary: The Capacity Reservation Group (CRG) ID used to associate the existing nodepool with the existing Capacity Reservation Group resource.

Copilot uses AI. Check for mistakes.
- name: Update a node pool with blue-green upgrade settings
text: az aks nodepool update -g MyResourceGroup -n nodepool1 --cluster-name MyManagedCluster --drain-batch-size 50% --drain-timeout-bg 5 --batch-soak-duration 10 --final-soak-duration 10
- name: Update a nodepool with a Capacity Reservation Group(CRG) ID.
text: az aks nodepool update -g MyResourceGroup -n MyNodePool --cluster-name MyMC --node-vm-size VMSize --crg-id "/subscriptions/SubID/resourceGroups/ResourceGroupName/providers/Microsoft.ContainerService/CapacityReservationGroups/MyCRGID"
Copy link

Copilot AI Apr 22, 2026

Choose a reason for hiding this comment

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

The example CRG resource ID uses the provider Microsoft.ContainerService/CapacityReservationGroups, but Capacity Reservation Groups are Microsoft.Compute/capacityReservationGroups (as also described in the SDK model docs). Using the wrong provider in docs will lead users to copy/paste an ID that the RP rejects—please update the example accordingly.

Suggested change
text: az aks nodepool update -g MyResourceGroup -n MyNodePool --cluster-name MyMC --node-vm-size VMSize --crg-id "/subscriptions/SubID/resourceGroups/ResourceGroupName/providers/Microsoft.ContainerService/CapacityReservationGroups/MyCRGID"
text: az aks nodepool update -g MyResourceGroup -n MyNodePool --cluster-name MyMC --node-vm-size VMSize --crg-id "/subscriptions/SubID/resourceGroups/ResourceGroupName/providers/Microsoft.Compute/capacityReservationGroups/MyCRGID"

Copilot uses AI. Check for mistakes.
Comment on lines +12 to +15
20.0.0b4
+++++++
* `az aks nodepool update`: Support `--node-vm-size` to resize VM size of an existing VMSS-based agent pool (preview). Requires AFEC registration `Microsoft.ContainerService/AgentPoolVMSSResize`.
* Add support for nodepool updating with Capacity Reservation Group.
* `az aks nodepool update --crg-id`
Copy link

Copilot AI Apr 22, 2026

Choose a reason for hiding this comment

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

This change removes the Pending section entirely, even though the file’s own guidance says new items should go under Pending when not releasing, and releases should move items out of Pending while keeping an (empty) Pending section for future changes. It also drops the previously listed Pending entry about az aks nodepool update VMSS resize support, so that change is no longer documented in any release section.

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

please fix failed unit test cases

- 2026-01-02-preview
-
* - 20.0.0b3 ~ latest
* - 20.0.0b4 ~ latest
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.

please restore the change for this file

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