Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[AKS] improve tab completion for VM sizes #5393

Merged
merged 3 commits into from
Jan 24, 2018

Conversation

mboersma
Copy link
Member

@mboersma mboersma commented Jan 24, 2018

Currently, hitting [TAB] for a --vm-size-type argument returns all VM sizes available for a location, as returned by the Compute Service. But AKS only supports a subset of those sizes, so the list can be misleading.

This changes the get_vm_size_completion_list completer function to return the intersection of the VM sizes allowed by the ACS SDK with those returned by the Compute Service.

$ az aks create --location eastus -s # [TAB]
$ az aks create --location eastus -s Standard_ # [TAB]
Display all 114 possibilities? (y or n)
Standard_A0             Standard_D12            Standard_D4_v2_Promo    Standard_DS2_v2         Standard_F16
Standard_A1             Standard_D12_v2         Standard_D4_v3          Standard_DS2_v2_Promo   Standard_F16s
Standard_A10            Standard_D12_v2_Promo   Standard_D4s_v3         Standard_DS3            Standard_F1s
Standard_A11            Standard_D13            Standard_D5_v2          Standard_DS3_v2         Standard_F2
Standard_A1_v2          Standard_D13_v2         Standard_D5_v2_Promo    Standard_DS3_v2_Promo   Standard_F2s
Standard_A2             Standard_D13_v2_Promo   Standard_D8_v3          Standard_DS4            Standard_F4
Standard_A2_v2          Standard_D14            Standard_D8s_v3         Standard_DS4_v2         Standard_F4s
Standard_A2m_v2         Standard_D14_v2         Standard_DS1            Standard_DS4_v2_Promo   Standard_F8
Standard_A3             Standard_D14_v2_Promo   Standard_DS11           Standard_DS5_v2         Standard_F8s
Standard_A4             Standard_D15_v2         Standard_DS11_v2        Standard_DS5_v2_Promo   Standard_H16
Standard_A4_v2          Standard_D16_v3         Standard_DS11_v2_Promo  Standard_E16_v3         Standard_H16m
Standard_A4m_v2         Standard_D16s_v3        Standard_DS12           Standard_E16s_v3        Standard_H16mr
Standard_A5             Standard_D1_v2          Standard_DS12_v2        Standard_E2_v3          Standard_H16r
Standard_A6             Standard_D2             Standard_DS12_v2_Promo  Standard_E2s_v3         Standard_H8
Standard_A7             Standard_D2_v2          Standard_DS13           Standard_E32_v3         Standard_H8m
Standard_A8             Standard_D2_v2_Promo    Standard_DS13_v2        Standard_E32s_v3        Standard_NC12
Standard_A8_v2          Standard_D2_v3          Standard_DS13_v2_Promo  Standard_E4_v3          Standard_NC24
Standard_A8m_v2         Standard_D2s_v3         Standard_DS14           Standard_E4s_v3         Standard_NC24r
Standard_A9             Standard_D3             Standard_DS14_v2        Standard_E64_v3         Standard_NC6
Standard_D1             Standard_D3_v2          Standard_DS14_v2_Promo  Standard_E64s_v3        Standard_NV12
Standard_D11            Standard_D3_v2_Promo    Standard_DS15_v2        Standard_E8_v3          Standard_NV24
Standard_D11_v2         Standard_D4             Standard_DS1_v2         Standard_E8s_v3         Standard_NV6
Standard_D11_v2_Promo   Standard_D4_v2          Standard_DS2            Standard_F1   
$ az aks create --location eastus -s Standard_

  • The PR has modified HISTORY.rst describing any customer-facing, functional changes. Note that this does not include changes only to help content. (see Modifying change log).

@promptws
Copy link

View a preview at https://prompt.ws/r/Azure/azure-cli/5393
This is an experimental preview for @microsoft users.

@tjprescott tjprescott added the ACS az acs/aks/openshift label Jan 24, 2018
Copy link
Member

@tjprescott tjprescott left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One question.

try:
location = namespace.location
except AttributeError:
location = get_one_of_subscription_locations(cmd.cli_ctx)
result = get_vm_sizes(cmd.cli_ctx, location)
return [r.name for r in result]
return sorted(list(set(r.name for r in result) & set(c.value for c in ContainerServiceVMSizeTypes)))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If ContainerServiceVMSizeTypes is a static enum, why not just add it as an enum_type instead of doing an API call?

Copy link
Member Author

@mboersma mboersma Jan 24, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You mean configure the argument in _params.py with something like get_enum_type(vm_size_types)? Seems like that should be added too. I was just trying to make minimal changes since this completer is shared by three arguments across az acs and az aks.

How does that interact with completer=get_vm_size_completion_list? The behavior in this PR is consistent with before--the list of VM sizes is dynamic, depending on a --location argument or the user's subscription locations.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, okay, that makes sense.

@tjprescott tjprescott added this to the Sprint 30 milestone Jan 24, 2018
@tjprescott tjprescott merged commit 18c7d82 into Azure:dev Jan 24, 2018
@haroldrandom haroldrandom added the ACS az acs/aks/openshift label Oct 25, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ACS az acs/aks/openshift
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants