[AKS] az aks nodepool delete: Add --ignore-pod-disruption-budget option for ignoring PodDisruptionBudget#30196
Conversation
️✔️AzureCLI-FullTest
|
|
Hi @tonychen15, |
|
| rule | cmd_name | rule_message | suggest_message |
|---|---|---|---|
| aks nodepool delete | cmd aks nodepool delete added parameter ignore_pdb |
|
Thank you for your contribution! We will review the pull request and get back to you soon. |
FumingZhang
left a comment
There was a problem hiding this comment.
Queued live test to validate the change.
| def get_ignore_pod_disruption_budget(self) -> bool: | ||
| return self._get_ignore_pod_disruption_budget() | ||
|
|
||
| def _get_ignore_pod_disruption_budget(self) -> bool: | ||
| """Obtain the value of ignore_pod_disruption_budget, default value is False. | ||
|
|
||
| :return: bool | ||
| """ | ||
| # read the original value passed by the command | ||
| ignore_pod_disruption_budget = self.raw_param.get("ignore_pod_disruption_budget", False) | ||
|
|
||
| # This parameter does not need dynamic completion. | ||
| return ignore_pod_disruption_budget |
There was a problem hiding this comment.
I think you don't need this as this is not an option for az aks nodepool add/update
There was a problem hiding this comment.
I see. I overlooked your comment in the code. Removed.
| def common_get_ignore_pod_disruption_budget(self): | ||
| ctx_1 = AKSAgentPoolContext( | ||
| self.cmd, | ||
| AKSAgentPoolParamDict({ | ||
| "ignore_pod_disruption_budget": True, | ||
| }), | ||
| self.models, | ||
| DecoratorMode.DELETE, | ||
| self.agentpool_decorator_mode, | ||
| ) | ||
| self.assertEqual(ctx_1.get_ignore_pod_disruption_budget(), True) | ||
|
|
There was a problem hiding this comment.
And there's no need for the test here.
There was a problem hiding this comment.
Removed, thanks.
| with self.argument_context("aks nodepool delete") as c: | ||
| c.argument( | ||
| "ignore_pod_disruption_budget", | ||
| options_list=["--ignore-pod-disruption-budget"], |
There was a problem hiding this comment.
If the only option form is --ignore-pod-disruption-budget, you could ignore this line. In cli-extensions/aks-preview, it has another shorthand option name -i, do you want to keep it?
There was a problem hiding this comment.
Got it. I intentionally remove that to make sure CX fully understand what they're doing.
There was a problem hiding this comment.
Need to add ignore-pdb as ignore-pod-disruption-budget exceeds the maximum length 22.
e48de17 to
c25039f
Compare
|
It seems both Python39 and Python312 failed at test case aks_agentpool_create_scale_delete with version 2020-09-01 (https://dev.azure.com/azclitools/public/_build/results?buildId=201476&view=logs&j=4e4d232d-230a-55c9-0730-4c1a9c36b9e5&t=6d1bdb99-245b-5117-da18-01d8df6f72c0&l=1356). Is this failed test case a known issue? |
|
What's the best practice for the option length is too long issue? |
| "use 'aks nodepool list' to get current node pool list".format(nodepool_name)) | ||
|
|
||
| return sdk_no_wait(no_wait, client.begin_delete, resource_group_name, cluster_name, nodepool_name) | ||
| return sdk_no_wait(no_wait, client.begin_delete, resource_group_name, cluster_name, nodepool_name, ignore_pod_disruption_budget=ignore_pod_disruption_budget) |
There was a problem hiding this comment.
| return sdk_no_wait(no_wait, client.begin_delete, resource_group_name, cluster_name, nodepool_name, ignore_pod_disruption_budget=ignore_pod_disruption_budget) | |
| from azure.cli.core.cloud import get_active_cloud | |
| active_cloud = get_active_cloud(cmd.cli_ctx) | |
| if active_cloud.profile != "latest": | |
| return sdk_no_wait( | |
| no_wait, | |
| client.begin_delete, | |
| resource_group_name, | |
| cluster_name, | |
| nodepool_name, | |
| ) | |
| else: | |
| return sdk_no_wait( | |
| no_wait, | |
| client.begin_delete, | |
| resource_group_name, | |
| cluster_name, | |
| nodepool_name, | |
| ignore_pod_disruption_budget=ignore_pod_disruption_budget, | |
| ) |
something like this can be used as a workaround to support both the old profile with 2020-11-01 as the default API version and the latest profile with the latest API version.
Please move from azure.cli.core.cloud import get_active_cloud to the top of this file
There was a problem hiding this comment.
Added. It seems it still doesn't work.
| with self.argument_context("aks nodepool delete") as c: | ||
| c.argument( | ||
| "ignore_pod_disruption_budget", | ||
| options_list=["--ignore-pod-disruption-budget, --ignore-pdb"], |
There was a problem hiding this comment.
You can add a rule exclusion to src/azure-cli/azure/cli/command_modules/acs/linter_exclusions.yml
| with self.argument_context("aks nodepool delete") as c: | ||
| c.argument( | ||
| "ignore_pod_disruption_budget", | ||
| options_list=["--ignore-pdb"], |
There was a problem hiding this comment.
| options_list=["--ignore-pdb"], | |
| options_list=["--ignore-pdb", "--ignore-pod-disruption-budget"], |
please also include the default option name
There was a problem hiding this comment.
Added back, hope that pylint not to report length too long error.
|
Requeued live test. The following cases failed in replay mode as you've changed the behavior of
There's a PR #30290 that bumped the default API version merged earlier today. Please rebase from dev branch, requeue the tests and them commit the updated recording files. |
|
/azp run |
|
Commenter does not have sufficient privileges for PR 30196 in repo Azure/azure-cli |
|
Please resolve the CI issues. |
| short-summary: The value provided will be compared to the ETag of the node pool, if it matches the operation will proceed. If it does not match, the request will be rejected to prevent accidental overwrites. This must not be specified when creating a new agentpool. | ||
| - name: --ignore-pdb | ||
| type: bool | ||
| short-summary: ignore-pdb deletes an existing nodepool without considering Pod Disruption Budget. |
There was a problem hiding this comment.
| short-summary: ignore-pdb deletes an existing nodepool without considering Pod Disruption Budget. | |
| short-summary: Delete an existing nodepool without considering Pod Disruption Budget. |
| "ignore_pdb", | ||
| options_list=["--ignore-pdb", "--ignore-pod-disruption-budget"], | ||
| action='store_true', | ||
| help="delete an AKS nodepool by ignoring PodDisruptionBudget setting", |
There was a problem hiding this comment.
| help="delete an AKS nodepool by ignoring PodDisruptionBudget setting", | |
| help="Delete an AKS nodepool by ignoring PodDisruptionBudget setting", |
|
Please note Azure CLI will freeze the code on 01/28/2025 10:00 UTC for the upcoming release. If you want to catch this release train, please resolve the comments ASAP, otherwise it has to be postponed to next sprint. |
|
please fix the CI issues. |
| """ | ||
| return self.raw_param.get("if_none_match") | ||
|
|
||
| def get_ignore_pod_disruption_budget(self) -> bool: |
There was a problem hiding this comment.
Where is the value of this option passed?
There was a problem hiding this comment.
Seems the option is only used by command aks nodepool delete, if that's the case, you could undo your changes in this file as the codes here are only for aks nodepool add/update and aks create/update.
|
I don't know how this help name --ignore-pdb is invalid. it is accepted by the _params.py, why it is not accepted by _help.py? whether they have different validation criteria? The failed two checks failed at the same place. @yanzhudd @FumingZhang " |
| """ | ||
| return self.raw_param.get("if_none_match") | ||
|
|
||
| def get_ignore_pod_disruption_budget(self) -> bool: |
There was a problem hiding this comment.
Seems the option is only used by command aks nodepool delete, if that's the case, you could undo your changes in this file as the codes here are only for aks nodepool add/update and aks create/update.
| - name: --if-match | ||
| type: string | ||
| short-summary: The value provided will be compared to the ETag of the node pool, if it matches the operation will proceed. If it does not match, the request will be rejected to prevent accidental overwrites. This must not be specified when creating a new agentpool. | ||
| - name: --ignore-pdb |
There was a problem hiding this comment.
the linter CI failed as you added another option form (-i) for this parameter, so you'll need to change this help info to one of the followings (I'm not sure which order the CI rule prefers, but it only considers one to be correct)
| - name: --ignore-pdb | |
| - name: --ignore-pdb -i |
| - name: --ignore-pdb | |
| - name: -i --ignore-pdb |
There was a problem hiding this comment.
Thanks for the suggestion. Hope it will work.
If it works, the git warning is somehow misleading and it should indicate one option is missed but not ignore-pdb is invalid.
FumingZhang
left a comment
There was a problem hiding this comment.
LGTM
Queued live test to validate the change, test passed!
az aks nodepool delete: Add --ignore-pod-disruption-budget option for ignoring PodDisruptionBudget
…option for ignoring PodDisruptionBudget (Azure#30196)
Related command
az aks nodepool delete
Description
Add
--ignore-pod-disruption-budgetoption for ignoring PodDisruptionBudget. This will expedite the nodepool deletion which may be delayed or blocked by PDB.Testing Guide
Use the command
az aks nodepool delete --ignore-pod-disruption-budgetto send the request to aks.History Notes
[AKS]
az aks nodepool delete: Add--ignore-pod-disruption-budgetoption for ignoring PodDisruptionBudgetThis 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.