az aks nodepool update supports crg id#9811
az aks nodepool update supports crg id#9811zjpjack-github wants to merge 3 commits intoAzure:mainfrom
Conversation
|
| rule | cmd_name | rule_message | suggest_message |
|---|---|---|---|
| aks nodepool update | cmd aks nodepool update added parameter crg_id |
|
Thank you for your contribution! We will review the pull request and get back to you soon. |
|
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). pip install azdev --upgrade
azdev setup -c <your azure-cli repo path> -r <your azure-cli-extensions repo path>
|
CodeGen Tools Feedback CollectionThank 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 |
|
There was a problem hiding this comment.
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-idargument wiring foraks nodepool updateand 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_crgstep during nodepool update to setcapacity_reservation_group_idon 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() |
There was a problem hiding this comment.
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.
| 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") |
| agentpool.enable_fips = False | ||
|
|
||
| return agentpool | ||
|
|
There was a problem hiding this comment.
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.
| # update crg id | ||
| agentpool = self.update_crg(agentpool) | ||
|
|
There was a problem hiding this comment.
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).
| 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. |
There was a problem hiding this comment.
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.
| 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. |
| - 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" |
There was a problem hiding this comment.
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.
| 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" |
| 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` |
There was a problem hiding this comment.
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.
FumingZhang
left a comment
There was a problem hiding this comment.
please fix failed unit test cases
| - 2026-01-02-preview | ||
| - | ||
| * - 20.0.0b3 ~ latest | ||
| * - 20.0.0b4 ~ latest |
There was a problem hiding this comment.
please restore the change for this file
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
azdev style <YOUR_EXT>locally? (pip install azdevrequired)python scripts/ci/test_index.py -qlocally? (pip install wheel==0.30.0required)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.jsonautomatically.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.