Skip to content

Commit 21210df

Browse files
authored
[AKS] az aks nodepool delete: Add --ignore-pod-disruption-budget option for ignoring PodDisruptionBudget (#30196)
1 parent 35a9996 commit 21210df

File tree

5 files changed

+1532
-11
lines changed

5 files changed

+1532
-11
lines changed

src/azure-cli/azure/cli/command_modules/acs/_help.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1668,9 +1668,12 @@
16681668
- name: --if-match
16691669
type: string
16701670
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.
1671+
- name: --ignore-pdb -i
1672+
type: bool
1673+
short-summary: Delete an existing nodepool without considering Pod Disruption Budget.
16711674
examples:
1672-
- name: Delete an agent pool with ignore-pod-disruption-budget
1673-
text: az aks nodepool delete --resource-group MyResourceGroup --cluster-name MyManagedCluster --name nodepool1 --if-match etag
1675+
- name: Delete an agent pool with ignore-pdb
1676+
text: az aks nodepool delete --resource-group MyResourceGroup --cluster-name MyManagedCluster --name nodepool1 --if-match etag --ignore-pdb
16741677
"""
16751678

16761679
helps['aks nodepool get-upgrades'] = """

src/azure-cli/azure/cli/command_modules/acs/_params.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -946,6 +946,7 @@ def load_arguments(self, _):
946946
c.argument('attach_zones')
947947

948948
with self.argument_context('aks nodepool delete') as c:
949+
c.argument('ignore_pdb', options_list=['--ignore-pdb', '-i'], action='store_true')
949950
c.argument("if_match")
950951

951952
with self.argument_context("aks nodepool delete-machines") as c:

src/azure-cli/azure/cli/command_modules/acs/custom.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2676,7 +2676,8 @@ def aks_agentpool_stop(cmd, # pylint: disable=unused-argument
26762676
def aks_agentpool_delete(cmd, client, resource_group_name, cluster_name,
26772677
nodepool_name,
26782678
no_wait=False,
2679-
if_match=None):
2679+
if_match=None,
2680+
ignore_pdb=None):
26802681
agentpool_exists = False
26812682
instances = client.list(resource_group_name, cluster_name)
26822683
for agentpool_profile in instances:
@@ -2688,11 +2689,10 @@ def aks_agentpool_delete(cmd, client, resource_group_name, cluster_name,
26882689
raise CLIError("Node pool {} doesnt exist, "
26892690
"use 'aks nodepool list' to get current node pool list".format(nodepool_name))
26902691

2691-
active_cloud = get_active_cloud(cmd.cli_ctx)
2692-
if active_cloud.profile != "latest":
2692+
if cmd.cli_ctx.cloud.profile != "latest":
26932693
return sdk_no_wait(no_wait, client.begin_delete, resource_group_name, cluster_name, nodepool_name)
26942694

2695-
return sdk_no_wait(no_wait, client.begin_delete, resource_group_name, cluster_name, nodepool_name, if_match=if_match)
2695+
return sdk_no_wait(no_wait, client.begin_delete, resource_group_name, cluster_name, nodepool_name, if_match=if_match, ignore_pod_disruption_budget=ignore_pdb)
26962696

26972697

26982698
def aks_agentpool_operation_abort(cmd,

0 commit comments

Comments
 (0)