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] az aks use-dev-spaces: Adding endpoint type option to use-dev-spaces command to customize the endpoint created on a controller #12028

Merged
merged 5 commits into from
Feb 25, 2020
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
12 changes: 10 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 @@ -852,16 +852,24 @@
- name: --space -s
type: string
short-summary: Name of the new or existing dev space to select. Defaults to an interactive selection experience.
- name: --endpoint -e
type: string
short-summary: The endpoint type to be used for a Azure Dev Spaces controller. See https://aka.ms/azds-networking for more information.
examples:
- name: Use Azure Dev Spaces with a managed Kubernetes cluster, interactively selecting a dev space.
text: |-
az aks use-dev-spaces -g my-aks-group -n my-aks
- name: Use Azure Dev Spaces with a managed Kubernetes cluster, updating to the latest Azure Dev Spaces \\ client components and selecting a new or existing dev space 'my-space'.
- name: Use Azure Dev Spaces with a managed Kubernetes cluster, updating to the latest Azure Dev Spaces \
client components and selecting a new or existing dev space 'my-space'.
text: |-
az aks use-dev-spaces -g my-aks-group -n my-aks --update --space my-space
- name: Use Azure Dev Spaces with a managed Kubernetes cluster, selecting a new or existing dev space \\ 'develop/my-space' without prompting for confirmation.
- name: Use Azure Dev Spaces with a managed Kubernetes cluster, selecting a new or existing dev space \
'develop/my-space' without prompting for confirmation.
text: |-
az aks use-dev-spaces -g my-aks-group -n my-aks -s develop/my-space -y
- name: Use Azure Dev Spaces with a managed Kubernetes cluster with a private endpoint.
text: |-
az aks use-dev-spaces -g my-aks-group -n my-aks -e private
"""

helps['aks wait'] = """
Expand Down
1 change: 1 addition & 0 deletions src/azure-cli/azure/cli/command_modules/acs/_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -308,6 +308,7 @@ def load_arguments(self, _):
with self.argument_context('aks use-dev-spaces') as c:
c.argument('update', options_list=['--update'], action='store_true')
c.argument('space_name', options_list=['--space', '-s'])
c.argument('endpoint_type', get_enum_type(['Public', 'Private', 'None'], default='Public'), options_list=['--endpoint', '-e'])
c.argument('prompt', options_list=['--yes', '-y'], action='store_true', help='Do not prompt for confirmation. Requires --space.')

with self.argument_context('aks remove-dev-spaces') as c:
Expand Down
11 changes: 8 additions & 3 deletions src/azure-cli/azure/cli/command_modules/acs/custom.py
Original file line number Diff line number Diff line change
Expand Up @@ -2174,7 +2174,8 @@ def aks_upgrade(cmd, client, resource_group_name, name, kubernetes_version, cont
DEV_SPACES_EXTENSION_MODULE = 'azext_dev_spaces.custom'


def aks_use_dev_spaces(cmd, client, name, resource_group_name, update=False, space_name=None, prompt=False):
def aks_use_dev_spaces(cmd, client, name, resource_group_name, update=False, space_name=None,
endpoint_type='Public', prompt=False):
"""
Use Azure Dev Spaces with a managed Kubernetes cluster.

Expand All @@ -2185,16 +2186,20 @@ def aks_use_dev_spaces(cmd, client, name, resource_group_name, update=False, spa
:type resource_group_name: String
:param update: Update to the latest Azure Dev Spaces client components.
:type update: bool
:param space_name: Name of the new or existing dev space to select. Defaults to an interactive selection experience.
:param space_name: Name of the new or existing dev space to select. Defaults to an \
interactive selection experience.
:type space_name: String
:param endpoint_type: The endpoint type to be used for a Azure Dev Spaces controller. \
See https://aka.ms/azds-networking for more information.
:type endpoint_type: String
:param prompt: Do not prompt for confirmation. Requires --space.
:type prompt: bool
"""

if _get_or_add_extension(cmd, DEV_SPACES_EXTENSION_NAME, DEV_SPACES_EXTENSION_MODULE, update):
azext_custom = _get_azext_module(DEV_SPACES_EXTENSION_NAME, DEV_SPACES_EXTENSION_MODULE)
try:
azext_custom.ads_use_dev_spaces(name, resource_group_name, update, space_name, prompt)
azext_custom.ads_use_dev_spaces(name, resource_group_name, update, space_name, endpoint_type, prompt)
except TypeError:
raise CLIError("Use '--update' option to get the latest Azure Dev Spaces client components.")
except AttributeError as ae:
Expand Down