Unclear error when specifying "az aks nodepool add" with --node-count 0
Describe the bug Azure CLI does not provide a clear error when setting "--node-count 0" To Reproduce
Create a normal AKS cluster
az group create -n tmf-clus-auto -l southcentralus
az aks create -g tmf-clus-auto -n tmf-clus-auto --node-count 2
Add a Nodepool with 0 nodes:
az aks nodepool add -g tmf-clus-auto --cluster-name tmf-clus-auto --name gpunodepool --node-count 0 --node-vm-size Standard_NC6
usage: az aks nodepool add [-h] [--verbose] [--debug] [--output {json,jsonc,table,tsv,yaml,none}] [--query JMESPATH] [--subscription _SUBSCRIPTION]
--resource-group RESOURCE_GROUP_NAME --cluster-name CLUSTER_NAME --name NODEPOOL_NAME [--kubernetes-version KUBERNETES_VERSION]
[--zones {1,2,3} [{1,2,3} ...]] [--node-vm-size NODE_VM_SIZE] [--node-osdisk-size NODE_OSDISK_SIZE] [--node-count NODE_COUNT]
[--vnet-subnet-id VNET_SUBNET_ID] [--max-pods MAX_PODS] [--os-type OS_TYPE] [--min-count MIN_COUNT] [--max-count MAX_COUNT]
[--enable-cluster-autoscaler] [--node-taints NODE_TAINTS] [--no-wait]
az aks nodepool add: error: division by zero
Expected behavior It should either provide a useful error message (e.g. "Node Count must be a positive integer"), or proceed to create the AKS node pool with 0 nodes in it. There is nothing in the documentation which says it cannot be of node-count 0
Environment summary Running on OSX. Reproduced issue on Azure Shell
…/tmp/spark az --version
azure-cli 2.0.80 *
command-modules-nspkg 2.0.3
core 2.0.80 *
nspkg 3.0.4
telemetry 1.0.4
Extensions:
k8sconfiguration 0.1.4
connectedk8s 0.1.1
azure-cli-iot-ext 0.7.1
aro 0.1.0 (dev) /Users/thfalgou/git/Azure/ARO-RP/python/az/aro
Python location '/usr/local/Cellar/azure-cli/2.0.80/libexec/bin/python'
Extensions directory '/Users/thfalgou/.azure/cliextensions'
Development extension sources:
/Users/thfalgou/git/Azure/ARO-RP/python
Python (Darwin) 3.8.1 (default, Dec 27 2019, 18:06:00)
[Clang 11.0.0 (clang-1100.0.33.16)]
Legal docs and information: aka.ms/AzureCliLegal
You have 2 updates available. Consider updating your CLI installation. Instructions can be found at https://docs.microsoft.com/en-us/cli/azure/install-azure-cli
Please let us know how we are doing: https://aka.ms/clihats
Additional context
Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @Azure/aks-pm.
thanks for reporting, routting to appropriate team
While the error message is indeed cryptic and not helpful. I think that soon enough this behaviour will change since AKS team are getting the support to setting the min-count to 0 for non system node pool.
https://github.com/Azure/AKS/issues/1565
@lastcoolnameleft - You are correct that there are no constraints applied to the node-count value being passed in via CLI.
@yungezz - specifying a node-count of 0 leads to an error when validating the value of max-pods. Looks like a validation with error message should be added to prevent node-count=0 here: https://github.com/Azure/azure-cli/blob/dev/src/azure-cli/azure/cli/command_modules/acs/_params.py#L157
Acknowledging this is an improvement on our backlog to fix to support size 0 user pools in CLI. This should be picked up soon. cc @marwanad @xizhamsft