Skip to content
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
128 changes: 0 additions & 128 deletions src/azure-cli/azure/cli/command_modules/acs/_help.py
Original file line number Diff line number Diff line change
Expand Up @@ -565,58 +565,6 @@
short-summary: Download and install kubectl, the Kubernetes command-line tool. Download and install kubelogin, a client-go credential (exec) plugin implementing azure authentication.
"""

helps['aks install-connector'] = """
type: command
short-summary: Install the ACI Connector on a managed Kubernetes cluster.
parameters:
- name: --chart-url
type: string
short-summary: URL of a Helm chart that installs ACI Connector.
- name: --connector-name
type: string
short-summary: Name of the ACI Connector.
- name: --os-type
type: string
short-summary: Install support for deploying ACIs of this operating system type.
- name: --service-principal
type: string
short-summary: Service principal used for authentication to Azure APIs.
long-summary: If not specified, use the AKS service principal defined in the file /etc/kubernetes/azure.json on the node which runs the virtual kubelet pod.
- name: --client-secret
type: string
short-summary: Secret associated with the service principal. This argument is required if `--service-principal` is specified.
- name: --image-tag
type: string
short-summary: The image tag of the virtual kubelet. Use 'latest' if it is not specified
- name: --aci-resource-group
type: string
short-summary: The resource group to create the ACI container groups. Use the MC_* resource group if it is not specified.
- name: --location -l
type: string
short-summary: The location to create the ACI container groups. Use the location of the MC_* resource group if it is not specified.
examples:
- name: Install the virtual Kubelet for Linux to a managed Kubernetes cluster.
text: |-
az aks install-connector --name MyManagedCluster --resource-group MyResourceGroup
- name: Install the virtual Kubelet for Windows to a managed Kubernetes cluster.
text: |-
az aks install-connector --name MyManagedCluster --resource-group MyResourceGroup \\
--connector-name virtual-kubelet --os-type Windows
- name: Install the virtual Kubelet for both Windows and Linux to a managed Kubernetes cluster.
text: |-
az aks install-connector --name MyManagedCluster --resource-group MyResourceGroup \\
--connector-name virtual-kubelet --os-type Both
- name: Install the virtual Kubelet using a specific service principal in a specific resource group.
text: |-
az aks install-connector --name MyManagedCluster --resource-group MyResourceGroup \\
--connector-name virtual-kubelet --service-principal {SPN_ID} --client-secret {SPN_SECRET} \\
--aci-resource-group ACI-resource-group
- name: Install the virtual Kubelet from a custom Helm chart with custom tag.
text: |-
az aks install-connector --name MyManagedCluster --resource-group MyResourceGroup \\
--connector-name virtual-kubelet --chart-url {CustomURL} --image-tag {VirtualKubeletImageTag}
"""

helps['aks list'] = """
type: command
short-summary: List managed Kubernetes clusters.
Expand Down Expand Up @@ -758,29 +706,6 @@
short-summary: Version of Kubernetes to upgrade the node pool to, such as "1.16.9".
"""

helps['aks remove-connector'] = """
type: command
short-summary: Remove the ACI Connector from a managed Kubernetes cluster.
parameters:
- name: --connector-name
type: string
short-summary: Name of the ACI Connector.
- name: --graceful
type: bool
short-summary: Use a "cordon and drain" strategy to evict pods safely before removing the ACI node.
- name: --os-type
type: string
short-summary: Remove support for deploying ACIs of this operating system type.
examples:
- name: Remove the ACI Connector from a cluster using the graceful mode.
text: |-
az aks remove-connector --name MyManagedCluster --resource-group MyResourceGroup \\
--connector-name MyConnector --graceful
- name: Remove the ACI Connector from a managed Kubernetes cluster. (autogenerated)
text: az aks remove-connector --connector-name MyConnector --name MyManagedCluster --os-type Windows --resource-group MyResourceGroup
crafted: true
"""

helps['aks remove-dev-spaces'] = """
type: command
short-summary: Remove Azure Dev Spaces from a managed Kubernetes cluster.
Expand Down Expand Up @@ -870,59 +795,6 @@
crafted: true
"""

helps['aks upgrade-connector'] = """
type: command
short-summary: Upgrade the ACI Connector on a managed Kubernetes cluster.
parameters:
- name: --chart-url
type: string
short-summary: URL of a Helm chart that installs ACI Connector.
- name: --connector-name
type: string
short-summary: Name of the ACI Connector.
- name: --os-type
type: string
short-summary: Install support for deploying ACIs of this operating system type.
- name: --service-principal
type: string
short-summary: Service principal used for authentication to Azure APIs.
long-summary: If not specified, use the AKS service principal defined in the file /etc/kubernetes/azure.json on the node which runs the virtual kubelet pod.
- name: --client-secret
type: string
short-summary: Secret associated with the service principal. This argument is required if `--service-principal` is specified.
- name: --image-tag
type: string
short-summary: The image tag of the virtual kubelet. Use 'latest' if it is not specified
- name: --aci-resource-group
type: string
short-summary: The resource group to create the ACI container groups. Use the MC_* resource group if it is not specified.
- name: --location -l
type: string
short-summary: The location to create the ACI container groups. Use the location of the MC_* resource group if it is not specified.
examples:
- name: Upgrade the ACI Connector for Linux to a managed Kubernetes cluster.
text: |-
az aks upgrade-connector --name MyManagedCluster --resource-group MyResourceGroup \\
--connector-name virtual-kubelet
- name: Upgrade the ACI Connector for Windows to a managed Kubernetes cluster.
text: |-
az aks upgrade-connector --name MyManagedCluster --resource-group MyResourceGroup \\
--connector-name virtual-kubelet --os-type Windows
- name: Upgrade the ACI Connector for both Windows and Linux to a managed Kubernetes cluster.
text: |-
az aks upgrade-connector --name MyManagedCluster --resource-group MyResourceGroup \\
--connector-name virtual-kubelet --os-type Both
- name: Upgrade the ACI Connector to use a specific service principal in a specific resource group.
text: |-
az aks upgrade-connector --name MyManagedCluster --resource-group MyResourceGroup \\
--connector-name virtual-kubelet --service-principal {SPN_ID} --client-secret {SPN_SECRET} \\
--aci-resource-group ACI-resource-group
- name: Upgrade the ACI Connector from a custom Helm chart with custom tag.
text: |-
az aks upgrade-connector --name MyManagedCluster --resource-group MyResourceGroup \\
--connector-name virtual-kubelet --chart-url {CustomURL} --image-tag {VirtualKubeletImageTag}
"""

helps['aks use-dev-spaces'] = """
type: command
short-summary: Use Azure Dev Spaces with a managed Kubernetes cluster.
Expand Down
35 changes: 1 addition & 34 deletions src/azure-cli/azure/cli/command_modules/acs/_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,12 @@
get_vm_size_completion_list, get_k8s_versions_completion_list, get_k8s_upgrades_completion_list)
from ._validators import (
validate_cluster_autoscaler_profile, validate_create_parameters, validate_kubectl_version, validate_kubelogin_version, validate_k8s_version, validate_linux_host_name,
validate_list_of_integers, validate_ssh_key, validate_connector_name, validate_nodes_count,
validate_list_of_integers, validate_ssh_key, validate_nodes_count,
validate_nodepool_name, validate_vm_set_type, validate_load_balancer_sku, validate_load_balancer_outbound_ips,
validate_load_balancer_outbound_ip_prefixes, validate_taints, validate_ip_ranges, validate_acr, validate_nodepool_tags,
validate_load_balancer_outbound_ports, validate_load_balancer_idle_timeout, validate_vnet_subnet_id, validate_nodepool_labels)
from ._consts import CONST_OUTBOUND_TYPE_LOAD_BALANCER, CONST_OUTBOUND_TYPE_USER_DEFINED_ROUTING

aci_connector_os_type = ['Windows', 'Linux', 'Both']

aci_connector_chart_url = 'https://github.com/virtual-kubelet/virtual-kubelet/raw/master/charts/virtual-kubelet-for-aks-latest.tgz'

orchestrator_types = ["Custom", "DCOS", "Kubernetes", "Swarm", "DockerCE"]

regions_in_preview = [
Expand Down Expand Up @@ -253,25 +249,6 @@ def load_arguments(self, _):
c.argument('kubelogin_version', validator=validate_kubelogin_version, help='Version of kubelogin to install.')
c.argument('kubelogin_install_location', default=_get_default_install_location('kubelogin'), help='Path at which to install kubelogin.')

with self.argument_context('aks install-connector') as c:
c.argument('aci_resource_group', help='The resource group to create the ACI container groups')
c.argument('chart_url', default=aci_connector_chart_url, help='URL to the chart')
c.argument('client_secret', help='Client secret to use with the service principal for making calls to Azure APIs')
c.argument('connector_name', default='aci-connector', help='The name for the ACI Connector', validator=validate_connector_name)
c.argument('image_tag', help='The image tag of the virtual kubelet')
c.argument('location', help='The location to create the ACI container groups')
c.argument('os_type', get_enum_type(aci_connector_os_type), help='The OS type of the connector')
c.argument('service_principal',
help='Service principal for making calls into Azure APIs. If not set, auto generate a new service principal of Contributor role, and save it locally for reusing')

with self.argument_context('aks remove-connector') as c:
c.argument('connector_name', default='aci-connector',
help='The name for the ACI Connector', validator=validate_connector_name)
c.argument('graceful', action='store_true',
help='Mention if you want to drain/uncordon your aci-connector to move your applications')
c.argument('os_type', get_enum_type(aci_connector_os_type),
help='The OS type of the connector')

with self.argument_context('aks update-credentials', arg_group='Service Principal') as c:
c.argument('reset_service_principal', action='store_true')
c.argument('service_principal')
Expand Down Expand Up @@ -320,16 +297,6 @@ def load_arguments(self, _):
c.argument('tags', tags_type)
c.argument('mode', get_enum_type(nodepool_mode_type))

with self.argument_context('aks upgrade-connector') as c:
c.argument('aci_resource_group')
c.argument('chart_url', default=aci_connector_chart_url)
c.argument('client_secret')
c.argument('connector_name', default='aci-connector', validator=validate_connector_name)
c.argument('image_tag')
c.argument('location')
c.argument('os_type', get_enum_type(aci_connector_os_type))
c.argument('service_principal')

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'])
Expand Down
14 changes: 0 additions & 14 deletions src/azure-cli/azure/cli/command_modules/acs/_validators.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,20 +21,6 @@
logger = get_logger(__name__)


def validate_connector_name(namespace):
"""Validates a string as a legal connector name.

This validation will also occur server-side in the kubernetes, but that may take
for a while. So it's more user-friendly to validate in the CLI pre-flight.
"""
# https://github.com/kubernetes/community/blob/master/contributors/design-proposals/architecture/identifiers.md
regex = re.compile(r'^[a-z0-9]([a-z0-9\-]*[a-z0-9])?$')
found = regex.findall(namespace.connector_name)
if not found:
raise CLIError('--connector-name must consist of lower case alphanumeric characters or dashes (-), '
'and must start and end with alphanumeric characters.')


def validate_ssh_key(namespace):
if hasattr(namespace, 'no_ssh_key') and namespace.no_ssh_key:
return
Expand Down
3 changes: 0 additions & 3 deletions src/azure-cli/azure/cli/command_modules/acs/commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,14 +86,11 @@ def load_command_table(self, _):
g.custom_command('get-credentials', 'aks_get_credentials')
g.command('get-upgrades', 'get_upgrade_profile', table_transformer=aks_upgrades_table_format)
g.custom_command('install-cli', 'k8s_install_cli', client_factory=None)
g.custom_command('install-connector', 'k8s_install_connector', is_preview=True)
g.custom_command('list', 'aks_list', table_transformer=aks_list_table_format)
g.custom_command('remove-connector', 'k8s_uninstall_connector', is_preview=True)
g.custom_command('remove-dev-spaces', 'aks_remove_dev_spaces')
g.custom_command('scale', 'aks_scale', supports_no_wait=True)
g.custom_show_command('show', 'aks_show', table_transformer=aks_show_table_format)
g.custom_command('upgrade', 'aks_upgrade', supports_no_wait=True)
g.custom_command('upgrade-connector', 'k8s_upgrade_connector', is_preview=True)
g.custom_command('use-dev-spaces', 'aks_use_dev_spaces')
g.custom_command('rotate-certs', 'aks_rotate_certs', supports_no_wait=True,
confirmation='Kubernetes will be unavailable during certificate rotation process.\n' +
Expand Down
Loading