azure-cli icon indicating copy to clipboard operation
azure-cli copied to clipboard

Autogenerated help example is wrong for `az aks enable-addons`

Open mikkelhegn opened this issue 6 years ago • 21 comments

This is autogenerated. Please review and update as needed.

The example in the help message of this command is wrong, and since it's autogenerated, I'm not sure how to commit a fix.

Command Name az aks enable-addons

Errors: This is the example

Examples Enable Kubernetes addons. (autogenerated) az aks enable-addons --addons virtual-node --name MyManagedCluster --resource-group MyResourceGroup

This is further up the help message, describing that --subnet is a required parameter:

virtual-node - enable AKS Virtual Node (PREVIEW). Requires --subnet-name to provide the name of an existing subnet-name for the Virtual Node to use.

To Reproduce:

Steps to reproduce the behavior. Note that argument values have been redacted, as they may contain sensitive information.

  • Put any pre-requisite steps here...
  • az aks enable-addons --help

Expected Behavior

The example show that --subnet-name is required

Environment Summary

Linux-4.19.104-microsoft-standard-x86_64-with-debian-buster-sid
Python 3.6.5

azure-cli 2.2.0 *

Additional Context

mikkelhegn avatar Apr 03 '20 14:04 mikkelhegn

Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @Azure/aks-pm.

ghost avatar Apr 03 '20 23:04 ghost

aks

yonzhan avatar Apr 03 '20 23:04 yonzhan

I'm on the AKS team - do we control how this get autogenerated?

mikkelhegn avatar Apr 06 '20 10:04 mikkelhegn

@haroldrandom to check whether it is autogenerated by Aladdin.

yonzhan avatar Apr 06 '20 11:04 yonzhan

@haroldrandom any updates here?

Jen7714 avatar May 29 '20 17:05 Jen7714

@Jen7714 Sorry for the late reply.

Yes, this example is auto generated one year ago. https://github.com/Azure/azure-cli/blob/5fe403f21d44a839eec1f358702076998bbc2f38/src/azure-cli/azure/cli/command_modules/acs/_help.py#L489-L492

Currently, we collabrate with Aladdin team, the will auto generate examples for Azure CLI, we review and merge them, then provide feedback to Aladdin to help to improve the AI who generates examples.

You could search PR like this https://github.com/Azure/azure-cli/pull/13492. Those examples are all prvoided by Aladdin automatically. We have merged serveral PRs like this.

We are testing this process internally, just for some of commands Azure CLI own. Once we think Aladdin provide examples are more stable, we will open more commands for you guys to review which include aks/acs of course.

Currently, we have to fix it manually. Could you create a PR to improve it?

haroldrandom avatar May 30 '20 02:05 haroldrandom

Did anyone pick up this? Could you create a PR to improve it?

mikkelhegn avatar Jun 23 '20 10:06 mikkelhegn

@MikkelHegn You could ping me as assignee, then we revert what Aladdin did or put on what you think is correct.

haroldrandom avatar Jun 28 '20 13:06 haroldrandom

@haroldrandom - not sure I understand your latest update. Do you want me to submit a PR with the change and assign the PR to you as a reviewer?

mikkelhegn avatar Jun 29 '20 12:06 mikkelhegn

not sure I understand your latest update. Do you want me to submit a PR with the change and assign the PR to you as a reviewer?

Yeah.

haroldrandom avatar Jun 29 '20 16:06 haroldrandom

I noticed that the aks-preview extension has the correct autogenerated help text. https://github.com/Azure/azure-cli-extensions/blob/29e8b3386e23c2d121059193ec72dadce98301d6/src/aks-preview/azext_aks_preview/_help.py#L644

Can you help figure out why that is the case?

mikkelhegn avatar Jun 30 '20 10:06 mikkelhegn

aks enable-addons both appear in Azure/azure-cli and Azure/azure-cli-extensions, I guess they might forget to sync this example between this 2 repos.

I noticed that the aks-preview extension has the correct autogenerated help text. https://github.com/Azure/azure-cli-extensions/blob/29e8b3386e23c2d121059193ec72dadce98301d6/src/aks-preview/azext_aks_preview/_help.py#L644

Can you help figure out why that is the case?

@fengzhou-msft @qwordy Could you help here ? What can we do to correct this?

haroldrandom avatar Jul 01 '20 04:07 haroldrandom

@haroldrandom can we submit a PR to fix it first, then ask Aladdin team to fix the autogeneratetion?

fengzhou-msft avatar Jul 01 '20 04:07 fengzhou-msft

@jluk Do you know why Azure CLI and Azure CLI extension have duplicate aks commands. Which one will be loaded and which help message will be loaded?

qwordy avatar Jul 01 '20 05:07 qwordy

The help text for az aks create for the --enable-addons also seems to be wrong as we have no support for virtual-node in that command:

➔ az aks create -g testcli -l westeurope -n test-cli -a virtual-node
Finished service principal creation[##################################]  100.0000%"virtual-node" is not recognized by the --enable-addons argument.

➔ az aks create -g testcli -l westeurope -n test-cli -a vn
Finished service principal creation[##################################]  100.0000%"vn" is not recognized by the --enable-addons argument.

mikkelhegn avatar Jul 08 '20 21:07 mikkelhegn

@qwordy they do have duplicate commands. From testing, it looks like the Azure CLI extension commands will overwrite the Azure CLI commands.

To make sure we stick to topic (sorry for being part of derailing), the main thing with this issue is to fix that the autogenerated "az aks enable-addons --help" message shows a wrong example of using virtual-node.

mikkelhegn avatar Aug 11 '20 09:08 mikkelhegn

Anything we can do to override the crafted example? Could we just PR the change here: https://github.com/Azure/azure-cli/blob/3f24ada49f3323d9310d46ccc1025dc99fc4cf8e/src/azure-cli/azure/cli/command_modules/acs/_help.py#L517 @qwordy @haroldrandom @fengzhou-msft

mikkelhegn avatar Aug 27 '20 12:08 mikkelhegn

You can modify it manually

qwordy avatar Aug 31 '20 02:08 qwordy

There are two issues here

  1. az aks enable-addons --addons virtual-node --name MyManagedCluster --resource-group MyResourceGroup I looked at the PR and found it's added in March 2019. With @MikkelHegn PR, I think we should not introduce it back again. We'll look at how we can prevent it in future. Most of the examples are from telemetry. I think we need to look examine the telemetry.
  2. The help text for az aks create for the --enable-addons also seems to be wrong as we have no support for virtual-node in that command. I do not see that example from 'az aks create'. I do see 'virtual-node' from '--help'. I guess at some point that's there and was removed. But the example wasn't updated accordingly.

Command
    az aks create : Create a new managed Kubernetes cluster.

Arguments
    --name -n                      [Required] : Name of the managed cluster.
    --resource-group -g            [Required] : Name of resource group. You can configure the
                                                default group using `az configure --defaults
                                                group=<name>`.
    --aad-client-app-id                       : The ID of an Azure Active Directory client
                                                application of type "Native". This application is
                                                for user login via kubectl.
    --aad-server-app-id                       : The ID of an Azure Active Directory server
                                                application of type "Web app/API". This application
                                                represents the managed cluster's apiserver (Server
                                                application).
    --aad-server-app-secret                   : The secret of an Azure Active Directory server
                                                application.
    --aad-tenant-id                           : The ID of an Azure Active Directory tenant.
    --admin-username -u                       : User account to create on node VMs for SSH access.
                                                Default: azureuser.
    --api-server-authorized-ip-ranges         : Comma seperated list of authorized apiserver IP
                                                ranges. Set to 0.0.0.0/32 to restrict apiserver
                                                traffic to node pools.
    --attach-acr                              : Grant the 'acrpull' role assignment to the ACR
                                                specified by name or resource ID.
    --client-secret                           : Secret associated with the service principal. This
                                                argument is required if `--service-principal` is
                                                specified.
    --disable-rbac                            : Disable Kubernetes Role-Based Access Control.
    --dns-name-prefix -p                      : Prefix for hostnames that are created. If not
                                                specified, generate a hostname using the managed
                                                cluster and resource group names.
    --dns-service-ip                          : An IP address assigned to the Kubernetes DNS
                                                service.
        This address must be within the Kubernetes service address range specified by "--service-
        cidr". For example, 10.0.0.10.
    --docker-bridge-address                   : A specific IP address and netmask for the Docker
                                                bridge, using standard CIDR notation.
        This address must not be in any Subnet IP ranges, or the Kubernetes service address range.
        For example, 172.17.0.1/16.
    --enable-addons -a                        : Enable the Kubernetes addons in a comma-separated
                                                list.
        These addons are available:
            http_application_routing - configure ingress with automatic public DNS name creation.
            monitoring - turn on Log Analytics monitoring. Uses the Log Analytics Default Workspace
        if it exists, else creates one.
                         Specify "--workspace-resource-id" to use an existing workspace.
                         If monitoring addon is enabled --no-wait argument will have no effect
            virtual-node - enable AKS Virtual Node (PREVIEW). Requires --subnet-name to provide the
        name of an existing subnet for the Virtual Node to use.
    --enable-cluster-autoscaler               : Enable cluster autoscaler, default value is false.
        If specified, please make sure the kubernetes version is larger than 1.10.6.
    --enable-managed-identity                 : Using a system assigned managed identity to manage
                                                cluster resource group.
    --enable-node-public-ip         [Preview] : Enable VMSS node public IP.
        Argument '--enable-node-public-ip' is in preview. It may be changed/removed in a future
        release.
    --enable-private-cluster                  : Enable private cluster.
    --generate-ssh-keys                       : Generate SSH public and private key files if
                                                missing. The keys will be stored in the ~/.ssh
                                                directory.
    --kubernetes-version -k                   : Version of Kubernetes to use for creating the
                                                cluster, such as "1.16.9".  Values from: `az aks
                                                get-versions`.
    --load-balancer-idle-timeout              : Load balancer idle timeout in minutes.
        Desired idle timeout for load balancer outbound flows, default is 30 minutes. Please specify
        a value in the range of [4, 120].
    --load-balancer-managed-outbound-ip-count : Load balancer managed outbound IP count.
        Desired number of managed outbound IPs for load balancer outbound connection. Valid for
        Standard SKU load balancer cluster only.
    --load-balancer-outbound-ip-prefixes      : Load balancer outbound IP prefix resource IDs.
        Comma-separated public IP prefix resource IDs for load balancer outbound connection. Valid
        for Standard SKU load balancer cluster only.
    --load-balancer-outbound-ips              : Load balancer outbound IP resource IDs.
        Comma-separated public IP resource IDs for load balancer outbound connection. Valid for
        Standard SKU load balancer cluster only.
    --load-balancer-outbound-ports            : Load balancer outbound allocated ports.
        Desired static number of outbound ports per VM in the load balancer backend pool. By
        default, set to 0 which uses the default allocation based on the number of VMs.
    --load-balancer-sku                       : Azure Load Balancer SKU selection for your cluster.
                                                basic or standard.
        Select between Basic or Standard Azure Load Balancer SKU for your AKS cluster.
    --location -l                             : Location. Values from: `az account list-locations`.
                                                You can configure the default location using `az
                                                configure --defaults location=<location>`.
    --max-count                               : Maximum nodes count used for autoscaler, when "--
                                                enable-cluster-autoscaler" specified. Please specify
                                                the value in the range of [1, 100].
    --max-pods -m                             : The maximum number of pods deployable to a node.
        If not specified, defaults to 110, or 30 for advanced networking configurations.
    --min-count                               : Minimum nodes count used for autoscaler, when "--
                                                enable-cluster-autoscaler" specified. Please specify
                                                the value in the range of [1, 100].
    --network-plugin                          : The Kubernetes network plugin to use.  Allowed
                                                values: azure, kubenet.
        Specify "azure" for advanced networking configurations. Defaults to "kubenet".
    --network-policy                          : The Kubernetes network policy to use.
        Using together with "azure" network plugin.
        Specify "azure" for Azure network policy manager and "calico" for calico network policy
        controller.
        Defaults to "" (network policy disabled).
    --no-ssh-key -x                           : Do not use or create a local SSH key.
        To access nodes after creating a cluster with this option, use the Azure Portal.
    --no-wait                                 : Do not wait for the long-running operation to
                                                finish.
    --node-count -c                           : Number of nodes in the Kubernetes node pool. After
                                                creating a cluster, you can change the size of its
                                                node pool with `az aks scale`.  Default: 3.
    --node-osdisk-size                        : Size in GB of the OS disk for each node in the node
                                                pool. Minimum 30 GB.
    --node-vm-size -s                         : Size of Virtual Machines to create as Kubernetes
                                                nodes.  Default: Standard_DS2_v2.
    --nodepool-labels                         : Space-separated labels: key[=value] [key[=value]
                                                ...]. You can not change the node labels through CLI
                                                after creation. See https://aka.ms/node-labels for
                                                syntax of labels.
    --nodepool-name                           : Node pool name, up to 12 alphanumeric characters.
                                                Default: nodepool1.
    --nodepool-tags                           : Space-separated tags: key[=value] [key[=value] ...].
                                                Use "" to clear existing tags.
    --outbound-type                           : How outbound traffic will be configured for a
                                                cluster.  Allowed values: loadBalancer,
                                                userDefinedRouting.
        Select between loadBalancer and userDefinedRouting. If not set, defaults to type
        loadBalancer. Requires --vnet-subnet-id to be provided with a preconfigured route table and
        --load-balancer-sku to be Standard.
    --pod-cidr                                : A CIDR notation IP range from which to assign pod
                                                IPs when kubenet is used.
        This range must not overlap with any Subnet IP ranges. For example, 172.244.0.0/16.
    --service-cidr                            : A CIDR notation IP range from which to assign
                                                service cluster IPs.
        This range must not overlap with any Subnet IP ranges. For example, 10.0.0.0/16.
    --service-principal                       : Service principal used for authentication to Azure
                                                APIs.
        If not specified, a new service principal is created and cached at
        $HOME/.azure/aksServicePrincipal.json to be used by subsequent `az aks` commands.
    --skip-subnet-role-assignment             : Skip role assignment for subnet (advanced
                                                networking).
        If specified, please make sure your service principal has the access to your subnet.
    --ssh-key-value                           : Public key path or key contents to install on node
                                                VMs for SSH access. For example, 'ssh-rsa
                                                AAAAB...snip...UcyupgH azureuser@linuxvm'.  Default:
                                                ~/.ssh/id_rsa.pub.
    --tags                                    : Space-separated tags: key[=value] [key[=value] ...].
                                                Use '' to clear existing tags.
    --uptime-sla                              : Enable a paid managed cluster service with a
                                                financially backed SLA.
    --vm-set-type                             : Agent pool vm set type. VirtualMachineScaleSets or
                                                AvailabilitySet.
    --vnet-subnet-id                          : The ID of a subnet in an existing VNet into which to
                                                deploy the cluster.
    --windows-admin-password                  : Password to create on Windows node VMs.
    --windows-admin-username                  : Username to create on Windows node VMs.
    --workspace-resource-id                   : The resource ID of an existing Log Analytics
                                                Workspace to use for storing monitoring data. If not
                                                specified, uses the default Log Analytics Workspace
                                                if it exists, otherwise creates one.
    --zones -z                                : Availability zones where agent nodes will be placed.
                                                Allowed values: 1, 2, 3.

Global Arguments
    --debug                                   : Increase logging verbosity to show all debug logs.
    --help -h                                 : Show this help message and exit.
    --only-show-errors                        : Only show errors, suppressing warnings.
    --output -o                               : Output format.  Allowed values: json, jsonc, none,
                                                table, tsv, yaml, yamlc.  Default: json.
    --query                                   : JMESPath query string. See http://jmespath.org/ for
                                                more information and examples.
    --subscription                            : Name or ID of subscription. You can configure the
                                                default subscription using `az account set -s
                                                NAME_OR_ID`.
    --verbose                                 : Increase logging verbosity. Use --debug for full
                                                debug logs.

Examples
    Create a new managed Kubernetes cluster. (autogenerated)
        az aks create --enable-addons {enable-addons} --generate-ssh-keys --name MyManagedCluster
        --node-count 7 --resource-group MyResourceGroup


    Create a Kubernetes cluster with an existing SSH public key.
        az aks create --resource-group MyResourceGroup --name MyManagedCluster --ssh-key-value
        /path/to/publickey


    Create a kubernetes cluster with default kubernetes version, default SKU load balancer
    (Standard) and default vm set type (VirtualMachineScaleSet).
        az aks create --resource-group MyResourceGroup --name MyManagedCluster


For more specific examples, use: az find "az aks create"

Please let us know how we are doing: https://aka.ms/azureclihats

I'm using azure cli 2.8

$ az --version
azure-cli                          2.8.0 *

command-modules-nspkg              2.0.3
core                               2.8.0 *
nspkg                              3.0.4
telemetry                          1.0.4 *

Extensions:
ai-examples                        0.2.1
azure-iot                          0.9.6

Python location '/opt/az/bin/python3'
Extensions directory '/home/mahuang/.azure/cliextensions'

kceiw avatar Sep 11 '20 16:09 kceiw

The az aks create --enable-addons is implemented in this PR: https://github.com/Azure/azure-cli/pull/15129

mikkelhegn avatar Sep 21 '20 07:09 mikkelhegn