From 2e8d142a682049ab25287b464a2a565944c3ae8b Mon Sep 17 00:00:00 2001 From: Matt Boersma Date: Fri, 2 Feb 2018 16:06:02 -0800 Subject: [PATCH] [AKS] remove k8s default version from CLI (#5456) * [AKS] remove k8s default version from CLI This allows the RP to set the default version if the user doesn't supply one explicitly. * Update HISTORY.rst for new `az aks create` default version behavior * Fix some errant indentation. --- src/command_modules/azure-cli-acs/HISTORY.rst | 1 + .../azure/cli/command_modules/acs/_help.py | 2 +- .../cli/command_modules/acs/_validators.py | 18 ++++++++++-------- .../azure/cli/command_modules/acs/custom.py | 2 +- 4 files changed, 13 insertions(+), 10 deletions(-) diff --git a/src/command_modules/azure-cli-acs/HISTORY.rst b/src/command_modules/azure-cli-acs/HISTORY.rst index a2b973f9ac1..b81d8c9af4d 100644 --- a/src/command_modules/azure-cli-acs/HISTORY.rst +++ b/src/command_modules/azure-cli-acs/HISTORY.rst @@ -5,6 +5,7 @@ Release History 2.0.26 ++++++ +* `aks create` defaults to letting the server choose the version of Kubernetes * `aks create` VM node size default changed from "Standard_D1_v2" to "Standard_DS1_v2" * improve reliability when locating the dashboard pod for `az aks browse` diff --git a/src/command_modules/azure-cli-acs/azure/cli/command_modules/acs/_help.py b/src/command_modules/azure-cli-acs/azure/cli/command_modules/acs/_help.py index af2573030ea..f4f9e0ff73d 100644 --- a/src/command_modules/azure-cli-acs/azure/cli/command_modules/acs/_help.py +++ b/src/command_modules/azure-cli-acs/azure/cli/command_modules/acs/_help.py @@ -166,7 +166,7 @@ short-summary: Size in GB of the OS disk for each node in the node pool. - name: --kubernetes-version -k type: string - short-summary: Version of Kubernetes to use for creating the cluster, such as "1.7.7" or "1.8.2". + short-summary: Version of Kubernetes to use for creating the cluster, such as "1.7.12" or "1.8.6". - name: --ssh-key-value type: string short-summary: Public key path or key contents to install on node VMs for SSH access. For example, diff --git a/src/command_modules/azure-cli-acs/azure/cli/command_modules/acs/_validators.py b/src/command_modules/azure-cli-acs/azure/cli/command_modules/acs/_validators.py index dc6c953055e..6a370ca6d8f 100644 --- a/src/command_modules/azure-cli-acs/azure/cli/command_modules/acs/_validators.py +++ b/src/command_modules/azure-cli-acs/azure/cli/command_modules/acs/_validators.py @@ -71,14 +71,16 @@ def validate_create_parameters(namespace): def validate_k8s_version(namespace): - """Validates a string as a possible Kubernetes version.""" - k8s_release_regex = re.compile(r'^[v|V]?(\d+\.\d+\.\d+.*)$') - found = k8s_release_regex.findall(namespace.kubernetes_version) - if found: - namespace.kubernetes_version = found[0] - else: - raise CLIError('--kubernetes-version should be the full version number, ' - 'such as "1.7.7" or "1.8.1"') + """Validates a string as a possible Kubernetes version. An empty string is also valid, which tells the server + to use its default version.""" + if namespace.kubernetes_version: + k8s_release_regex = re.compile(r'^[v|V]?(\d+\.\d+\.\d+.*)$') + found = k8s_release_regex.findall(namespace.kubernetes_version) + if found: + namespace.kubernetes_version = found[0] + else: + raise CLIError('--kubernetes-version should be the full version number, ' + 'such as "1.7.12" or "1.8.6"') def validate_k8s_client_version(namespace): diff --git a/src/command_modules/azure-cli-acs/azure/cli/command_modules/acs/custom.py b/src/command_modules/azure-cli-acs/azure/cli/command_modules/acs/custom.py index 06dde8a9b03..e3a128e7987 100644 --- a/src/command_modules/azure-cli-acs/azure/cli/command_modules/acs/custom.py +++ b/src/command_modules/azure-cli-acs/azure/cli/command_modules/acs/custom.py @@ -1253,7 +1253,7 @@ def aks_create(cmd, client, resource_group_name, name, ssh_key_value, # pylint: dns_name_prefix=None, location=None, admin_username="azureuser", - kubernetes_version="1.7.7", + kubernetes_version='', node_vm_size="Standard_DS1_v2", node_osdisk_size=0, node_count=3,