[AKS] az aks nodepool rollback: Add rollback commands#33509
Conversation
️✔️AzureCLI-FullTest
|
|
| rule | cmd_name | rule_message | suggest_message |
|---|---|---|---|
| aks nodepool get-rollback-versions | cmd aks nodepool get-rollback-versions added |
||
| aks nodepool rollback | cmd aks nodepool rollback added |
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
Adds new AKS nodepool rollback functionality to expose rollback history and roll back a node pool to its most recently used version.
Changes:
- Introduces
az aks nodepool get-rollback-versionsto list rollback candidates. - Introduces
az aks nodepool rollbackto roll back to the most recent (N-1) version. - Adds help text, table output formatting, and release notes entry.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| src/azure-cli/azure/cli/command_modules/acs/custom.py | Implements rollback versions retrieval and rollback operation logic |
| src/azure-cli/azure/cli/command_modules/acs/commands.py | Wires new commands into the command table and table formatter |
| src/azure-cli/azure/cli/command_modules/acs/_params.py | Adds parameter context for the new rollback command |
| src/azure-cli/azure/cli/command_modules/acs/_help.py | Documents new commands and parameters |
| src/azure-cli/azure/cli/command_modules/acs/_format.py | Adds table transformer for rollback versions output |
| src/azure-cli/HISTORY.rst | Mentions new commands in release history |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| sorted_versions = sorted( | ||
| upgrade_profile.recently_used_versions, | ||
| key=lambda version: version.timestamp if version.timestamp else datetime.datetime.min, | ||
| reverse=True, | ||
| ) |
| if upgrade_channel_enabled or node_os_channel_enabled: | ||
| logger.warning( | ||
| "Auto-upgrade is enabled on cluster '%s' (upgradeChannel=%s, nodeOSUpgradeChannel=%s). " | ||
| "Rollback will not succeed until auto-upgrade is disabled. Please disable auto-upgrade to roll back the node pool.", | ||
| cluster_name, | ||
| upgrade_channel or "none", | ||
| node_os_upgrade_channel or "Unmanaged", | ||
| ) |
| def _format_rollback_version(result): | ||
| parsed = compile_jmes("""{ | ||
| kubernetesVersion: orchestratorVersion, | ||
| nodeImageVersion: nodeImageVersion, | ||
| timestamp: timestamp | ||
| }""") | ||
| return parsed.search(result, Options(dict_cls=OrderedDict)) | ||
|
|
||
| return [_format_rollback_version(r) for r in results] |
4165ddc to
137c671
Compare
|
AKS |
FumingZhang
left a comment
There was a problem hiding this comment.
please fix failed CI checks @InduSridhar
| **AKS** | ||
|
|
||
| * `az aks add/update`: Add `--enable-artifact-streaming` and `--disable-artifact-streaming` parameters (#33257) | ||
| * `az aks nodepool get-rollback-versions`, `az aks nodepool rollback`: Add commands to get rollback versions and roll back an agent pool to the most recently used configuration. |
There was a problem hiding this comment.
please don't manually touch the history note file for changes to official azure-cli, it will generate the history note automatically based on PR title
35b3450 to
ccf8dd8
Compare
az aks nodepool rollback: Add rollback commands
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
ccf8dd8 to
7b1bd5d
Compare
|
|
||
| @AllowLargeResponse() | ||
| @AKSCustomResourceGroupPreparer(random_name_length=17, name_prefix='clitest', location='westus2') | ||
| def test_aks_nodepool_rollback(self, resource_group, resource_group_location): |
There was a problem hiding this comment.
Queued live test to validate the change, test passed!
Related command
az aks nodepool get-rollback-versionsaz aks nodepool rollbackDescription
This PR adds GA Azure CLI support for AKS agentpool rollback, matching the aks-preview extension implementation for the 2026-04 GA API surface.
Changes:
az aks nodepool get-rollback-versionsto returnrecently_used_versionsfrom the agent pool upgrade profile.az aks nodepool rollbackto roll back an agent pool to the most recently used Kubernetes and node image version.Testing Guide
Added unit coverage in
azure.cli.command_modules.acs.tests.latest.test_customfor:begin_create_or_update.CLIErrorwhen no rollback history is available.Added live/recorded scenario coverage in
azure.cli.command_modules.acs.tests.latest.test_aks_commands.AzureKubernetesServiceScenarioTest.test_aks_nodepool_rollbackfor:az aks nodepool rollback.showreturn the rollback Kubernetes and node image versions.Validation:
azdev test azure.cli.command_modules.acs.tests.latest.test_aks_commands.AzureKubernetesServiceScenarioTest.test_aks_nodepool_rollback --live --seriespassed,1 passed in 1117.70s.azdev test azure.cli.command_modules.acs.tests.latest.test_aks_commands.AzureKubernetesServiceScenarioTest.test_aks_nodepool_rollback --seriespassed,1 passed in 52.35s.git diff --checkpassed.Azure.azure-cli Full Test,azdev-linter,azdev-style, andAzure.azure-cli Breaking Change Testsucceeded.History Notes
[AKS]
az aks nodepool get-rollback-versions,az aks nodepool rollback: Add commands to get rollback versions and roll back an agent pool to the most recently used configuration.This checklist is used to make sure that common guidelines for a pull request are followed.
The PR title and description has followed the guideline in Submitting Pull Requests.
I adhere to the Command Guidelines.
I adhere to the Error Handling Guidelines.