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
9 changes: 7 additions & 2 deletions src/azure-cli/azure/cli/command_modules/acs/_help.py
Original file line number Diff line number Diff line change
Expand Up @@ -622,7 +622,7 @@

helps['aks update'] = """
type: command
short-summary: Update a managed Kubernetes cluster.
short-summary: Update a managed Kubernetes cluster. When called with no optional arguments this attempts to move the cluster to its goal state without changing the current cluster configuration. This can be used to move out of a non succeeded state.
parameters:
- name: --enable-cluster-autoscaler -e
type: bool
Expand Down Expand Up @@ -801,6 +801,8 @@
short-summary: HTTP Proxy configuration for this cluster.

examples:
- name: Reconcile the cluster back to its current state.
text: az aks update -g MyResourceGroup -n MyManagedCluster
- name: Update a kubernetes cluster with standard SKU load balancer to use two AKS created IPs for the load balancer outbound connection usage.
text: az aks update -g MyResourceGroup -n MyManagedCluster --load-balancer-managed-outbound-ip-count 2
- name: Update a kubernetes cluster with standard SKU load balancer to use the provided public IPs for the load balancer outbound connection usage.
Expand Down Expand Up @@ -1161,7 +1163,8 @@

helps['aks nodepool update'] = """
type: command
short-summary: Update a node pool to enable/disable cluster-autoscaler or change min-count or max-count
short-summary: Update a node pool properties.
long-summary: Update a node pool to enable/disable cluster-autoscaler or change min-count or max-count. When called with no optional arguments this attempts to move the node pool to its goal state without changing the current node pool configuration. This can be used to move out of a non succeeded state.
parameters:
- name: --enable-cluster-autoscaler -e
type: bool
Expand Down Expand Up @@ -1197,6 +1200,8 @@
type: string
short-summary: Comma-separated key-value pairs to specify custom headers.
examples:
- name: Reconcile the nodepool back to its current state.
text: az aks nodepool update -g MyResourceGroup -n nodepool1 --cluster-name MyManagedCluster
- name: Enable cluster-autoscaler within node count range [1,5]
text: az aks nodepool update --enable-cluster-autoscaler --min-count 1 --max-count 5 -g MyResourceGroup -n nodepool1 --cluster-name MyManagedCluster
- name: Disable cluster-autoscaler for an existing cluster
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
check_is_managed_aad_cluster,
check_is_msi_cluster,
check_is_private_cluster,
format_parameter_name_to_option_name,
get_user_assigned_identity_by_resource_id,
map_azure_error_to_cli_error,
safe_list_get,
Expand Down Expand Up @@ -5377,49 +5378,18 @@ def check_raw_parameters(self):
)

if not is_changed and is_default:
# Note: Uncomment the followings to automatically generate the error message.
# option_names = [
# '"{}"'.format(format_parameter_name_to_option_name(x))
# for x in self.context.raw_param.keys()
# if x not in excluded_keys
# ]
# error_msg = "Please specify one or more of {}.".format(
# " or ".join(option_names)
# )
# raise RequiredArgumentMissingError(error_msg)
raise RequiredArgumentMissingError(
'Please specify one or more of "--enable-cluster-autoscaler" or '
'"--disable-cluster-autoscaler" or '
'"--update-cluster-autoscaler" or '
'"--cluster-autoscaler-profile" or '
'"--load-balancer-managed-outbound-ip-count" or '
'"--load-balancer-outbound-ips" or '
'"--load-balancer-outbound-ip-prefixes" or '
'"--load-balancer-outbound-ports" or '
'"--load-balancer-idle-timeout" or '
'"--nat-gateway-managed-outbound-ip-count" or '
'"--nat-gateway-idle-timeout" or '
'"--auto-upgrade-channel" or '
'"--attach-acr" or "--detach-acr" or '
'"--uptime-sla" or '
'"--no-uptime-sla" or '
'"--api-server-authorized-ip-ranges" or '
'"--enable-aad" or '
'"--aad-tenant-id" or '
'"--aad-admin-group-object-ids" or '
'"--enable-ahub" or '
'"--disable-ahub" or '
'"--windows-admin-password" or '
'"--enable-managed-identity" or '
'"--assign-identity" or '
'"--enable-azure-rbac" or '
'"--disable-azure-rbac" or '
'"--enable-public-fqdn" or '
'"--disable-public-fqdn" or '
'"--tags" or '
'"--nodepool-labels" or '
'"--enble-windows-gmsa".'
)
reconcilePrompt = 'no argument specified to update would you like to reconcile to current settings?'
if not prompt_y_n(reconcilePrompt, default="n"):
# Note: Uncomment the followings to automatically generate the error message.
option_names = [
'"{}"'.format(format_parameter_name_to_option_name(x))
for x in self.context.raw_param.keys()
if x not in excluded_keys
]
error_msg = "Please specify one or more of {}.".format(
" or ".join(option_names)
)
raise RequiredArgumentMissingError(error_msg)

def _ensure_mc(self, mc: ManagedCluster) -> None:
"""Internal function to ensure that the incoming `mc` object is valid and the same as the attached `mc` object
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6637,7 +6637,17 @@ def test_check_raw_parameters(self):
ResourceType.MGMT_CONTAINERSERVICE,
)
# fail on no updated parameter provided
with self.assertRaises(RequiredArgumentMissingError):
with patch(
"azure.cli.command_modules.acs.managed_cluster_decorator.prompt_y_n",
return_value=False,
), self.assertRaises(RequiredArgumentMissingError):
dec_1.check_raw_parameters()

# unless user says they want to reconcile
with patch(
"azure.cli.command_modules.acs.managed_cluster_decorator.prompt_y_n",
return_value=True,
):
dec_1.check_raw_parameters()

# custom value
Expand Down