Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions src/aks-preview/azext_aks_preview/_help.py
Original file line number Diff line number Diff line change
Expand Up @@ -805,6 +805,25 @@

"""

helps['aks delete'] = """
type: command
short-summary: Delete a managed Kubernetes cluster.
parameters:
- name: --if-match
type: string
short-summary: The value provided will be compared to the ETag of the managed cluster, if it matches the operation will proceed. If it does not match, the request will be rejected to prevent accidental overwrites.
- name: --if-none-match
type: string
short-summary: Not applicable for delete operations. This option will be ignored if provided.
- name: --ignore-pod-disruption-budget
type: bool
short-summary: Delete those pods on a node without considering Pod Disruption Budget.
examples:
- name: Delete a managed Kubernetes cluster.
text: az aks delete --name MyManagedCluster --resource-group MyResourceGroup
crafted: true
"""

helps['aks scale'] = """
type: command
short-summary: Scale the node pool in a managed Kubernetes cluster.
Expand Down
5 changes: 5 additions & 0 deletions src/aks-preview/azext_aks_preview/_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -1821,6 +1821,11 @@ def load_arguments(self, _):
help="Disable continuous control plane and addon monitor for the cluster.",
)

with self.argument_context("aks delete") as c:
c.argument("if_match")
c.argument("if_none_match")
c.argument("ignore_pod_disruption_budget", action="store_true")

with self.argument_context("aks upgrade") as c:
c.argument("kubernetes_version", completer=get_k8s_upgrades_completion_list)
c.argument(
Expand Down
2 changes: 1 addition & 1 deletion src/aks-preview/azext_aks_preview/commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ def load_command_table(self, _):
)
g.custom_command("upgrade", "aks_upgrade", supports_no_wait=True)
g.custom_command("scale", "aks_scale", supports_no_wait=True)
g.command("delete", "begin_delete", supports_no_wait=True, confirmation=True)
g.custom_command("delete", "aks_delete", supports_no_wait=True, confirmation=True)
g.custom_show_command(
"show", "aks_show", table_transformer=aks_show_table_format
)
Expand Down
16 changes: 16 additions & 0 deletions src/aks-preview/azext_aks_preview/custom.py
Original file line number Diff line number Diff line change
Expand Up @@ -1445,6 +1445,22 @@ def aks_show(cmd, client, resource_group_name, name, aks_custom_headers=None):
return _remove_nulls([mc])[0]


def aks_delete(cmd, client, resource_group_name, name, no_wait=False,
if_match=None, if_none_match=None, ignore_pod_disruption_budget=None):
if if_none_match is not None:
logger.warning(
"The '--if-none-match' option is not applicable to delete operations and will be ignored."
)
return sdk_no_wait(
Comment on lines +1448 to +1454
no_wait,
client.begin_delete,
resource_group_name,
name,
if_match=if_match,
ignore_pod_disruption_budget=ignore_pod_disruption_budget,
)


# pylint: disable=unused-argument
def aks_stop(cmd, client, resource_group_name, name, no_wait=False):
instance = client.get(resource_group_name, name)
Expand Down
Loading