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
14 changes: 9 additions & 5 deletions src/azure-cli/azure/cli/command_modules/acs/_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

from distutils.version import StrictVersion # pylint: disable=no-name-in-module,import-error
# pylint: disable=no-name-in-module,import-error
from azure.mgmt.containerservice.v2021_02_01.models import ManagedClusterAPIServerAccessProfile
from azure.mgmt.containerservice.v2021_03_01.models import ManagedClusterAPIServerAccessProfile
from knack.util import CLIError
from ._consts import CONST_OUTBOUND_TYPE_LOAD_BALANCER, CONST_OUTBOUND_TYPE_USER_DEFINED_ROUTING

Expand All @@ -22,10 +22,12 @@ def _populate_api_server_access_profile(api_server_authorized_ip_ranges, enable_
if api_server_authorized_ip_ranges is None or api_server_authorized_ip_ranges == "":
authorized_ip_ranges = []
else:
authorized_ip_ranges = [ip.strip() for ip in api_server_authorized_ip_ranges.split(",")]
authorized_ip_ranges = [
ip.strip() for ip in api_server_authorized_ip_ranges.split(",")]

if profile.enable_private_cluster and authorized_ip_ranges:
raise CLIError('--api-server-authorized-ip-ranges is not supported for private cluster')
raise CLIError(
'--api-server-authorized-ip-ranges is not supported for private cluster')

profile.authorized_ip_ranges = authorized_ip_ranges
return profile
Expand Down Expand Up @@ -66,7 +68,8 @@ def _set_outbound_type(outbound_type, vnet_subnet_id, load_balancer_sku, load_ba
return CONST_OUTBOUND_TYPE_LOAD_BALANCER

if load_balancer_sku == "basic":
raise CLIError("userDefinedRouting doesn't support basic load balancer sku")
raise CLIError(
"userDefinedRouting doesn't support basic load balancer sku")

if vnet_subnet_id in ["", None]:
raise CLIError("--vnet-subnet-id must be specified for userDefinedRouting and it must \
Expand All @@ -76,7 +79,8 @@ def _set_outbound_type(outbound_type, vnet_subnet_id, load_balancer_sku, load_ba
if (load_balancer_profile.managed_outbound_ips or
load_balancer_profile.outbound_ips or
load_balancer_profile.outbound_ip_prefixes):
raise CLIError("userDefinedRouting doesn't support customizing a standard load balancer with IP addresses")
raise CLIError(
"userDefinedRouting doesn't support customizing a standard load balancer with IP addresses")

return CONST_OUTBOUND_TYPE_USER_DEFINED_ROUTING

Expand Down
19 changes: 11 additions & 8 deletions src/azure-cli/azure/cli/command_modules/acs/_loadbalancer.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@
from distutils.version import StrictVersion # pylint: disable=no-name-in-module,import-error

# pylint: disable=no-name-in-module,import-error
from azure.mgmt.containerservice.v2021_02_01.models import ManagedClusterLoadBalancerProfile
from azure.mgmt.containerservice.v2021_02_01.models import ManagedClusterLoadBalancerProfileManagedOutboundIPs
from azure.mgmt.containerservice.v2021_02_01.models import ManagedClusterLoadBalancerProfileOutboundIPPrefixes
from azure.mgmt.containerservice.v2021_02_01.models import ManagedClusterLoadBalancerProfileOutboundIPs
from azure.mgmt.containerservice.v2021_02_01.models import ResourceReference
from azure.mgmt.containerservice.v2021_03_01.models import ManagedClusterLoadBalancerProfile
from azure.mgmt.containerservice.v2021_03_01.models import ManagedClusterLoadBalancerProfileManagedOutboundIPs
from azure.mgmt.containerservice.v2021_03_01.models import ManagedClusterLoadBalancerProfileOutboundIPPrefixes
from azure.mgmt.containerservice.v2021_03_01.models import ManagedClusterLoadBalancerProfileOutboundIPs
from azure.mgmt.containerservice.v2021_03_01.models import ResourceReference

from knack.log import get_logger

Expand Down Expand Up @@ -57,7 +57,8 @@ def configure_load_balancer_profile(managed_outbound_ip_count, outbound_ips, out
return profile

outbound_ip_resources = _get_load_balancer_outbound_ips(outbound_ips)
outbound_ip_prefix_resources = _get_load_balancer_outbound_ip_prefixes(outbound_ip_prefixes)
outbound_ip_prefix_resources = _get_load_balancer_outbound_ip_prefixes(
outbound_ip_prefixes)

if managed_outbound_ip_count or outbound_ip_resources or outbound_ip_prefix_resources:
profile.managed_outbound_ips = None
Expand Down Expand Up @@ -96,7 +97,8 @@ def _get_load_balancer_outbound_ips(load_balancer_outbound_ips):
load_balancer_outbound_ip_resources = None
if load_balancer_outbound_ips:
load_balancer_outbound_ip_resources = \
[ResourceReference(id=x.strip()) for x in load_balancer_outbound_ips.split(',')]
[ResourceReference(id=x.strip())
for x in load_balancer_outbound_ips.split(',')]
return load_balancer_outbound_ip_resources


Expand All @@ -106,5 +108,6 @@ def _get_load_balancer_outbound_ip_prefixes(load_balancer_outbound_ip_prefixes):
load_balancer_outbound_ip_prefix_resources = None
if load_balancer_outbound_ip_prefixes:
load_balancer_outbound_ip_prefix_resources = \
[ResourceReference(id=x.strip()) for x in load_balancer_outbound_ip_prefixes.split(',')]
[ResourceReference(id=x.strip())
for x in load_balancer_outbound_ip_prefixes.split(',')]
return load_balancer_outbound_ip_prefix_resources
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
from azure.cli.core.azclierror import InvalidArgumentValueError
import azure.cli.core.keys as keys

from azure.mgmt.containerservice.v2021_02_01.models import ManagedClusterPropertiesAutoScalerProfile
from azure.mgmt.containerservice.v2021_03_01.models import ManagedClusterPropertiesAutoScalerProfile

logger = get_logger(__name__)

Expand Down
56 changes: 37 additions & 19 deletions src/azure-cli/azure/cli/command_modules/acs/commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ def load_command_table(self, _):
)

managed_clusters_sdk = CliCommandType(
operations_tmpl='azure.mgmt.containerservice.v2021_02_01.operations.'
operations_tmpl='azure.mgmt.containerservice.v2021_03_01.operations.'
'_managed_clusters_operations#ManagedClustersOperations.{}',
client_factory=cf_managed_clusters
)
Expand Down Expand Up @@ -66,7 +66,8 @@ def load_command_table(self, _):
# ACS Mesos DC/OS commands
with self.command_group('acs dcos', container_services_sdk, client_factory=cf_container_services) as g:
g.custom_command('browse', 'dcos_browse')
g.custom_command('install-cli', 'dcos_install_cli', client_factory=None)
g.custom_command('install-cli', 'dcos_install_cli',
client_factory=None)

# ACS Kubernetes commands
with self.command_group('acs kubernetes', container_services_sdk, client_factory=cf_container_services) as g:
Expand All @@ -80,19 +81,27 @@ def load_command_table(self, _):
g.custom_command('create', 'aks_create', supports_no_wait=True)
g.custom_command('update', 'aks_update', supports_no_wait=True)
g.command('delete', 'delete', supports_no_wait=True, confirmation=True)
g.custom_command('update-credentials', 'aks_update_credentials', supports_no_wait=True)
g.custom_command('disable-addons', 'aks_disable_addons', supports_no_wait=True)
g.custom_command('enable-addons', 'aks_enable_addons', supports_no_wait=True)
g.custom_command('update-credentials',
'aks_update_credentials', supports_no_wait=True)
g.custom_command('disable-addons', 'aks_disable_addons',
supports_no_wait=True)
g.custom_command('enable-addons', 'aks_enable_addons',
supports_no_wait=True)
g.custom_command('get-credentials', 'aks_get_credentials')
g.custom_command('check-acr', 'aks_check_acr')
g.command('get-upgrades', 'get_upgrade_profile', table_transformer=aks_upgrades_table_format)
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('list', 'aks_list', table_transformer=aks_list_table_format)
g.custom_command('remove-dev-spaces', 'aks_remove_dev_spaces', deprecate_info=g.deprecate())
g.custom_command('list', 'aks_list',
table_transformer=aks_list_table_format)
g.custom_command('remove-dev-spaces',
'aks_remove_dev_spaces', deprecate_info=g.deprecate())
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_show_command('show', 'aks_show',
table_transformer=aks_show_table_format)
g.custom_command('upgrade', 'aks_upgrade', supports_no_wait=True)
g.custom_command('use-dev-spaces', 'aks_use_dev_spaces', deprecate_info=g.deprecate())
g.custom_command('use-dev-spaces', 'aks_use_dev_spaces',
deprecate_info=g.deprecate())
g.custom_command('rotate-certs', 'aks_rotate_certs', supports_no_wait=True,
confirmation='Kubernetes will be unavailable during certificate rotation process.\n' +
'Are you sure you want to perform this operation?')
Expand All @@ -101,17 +110,23 @@ def load_command_table(self, _):
g.command('start', 'start', supports_no_wait=True)

with self.command_group('aks', container_services_sdk, client_factory=cf_container_services) as g:
g.custom_command('get-versions', 'aks_get_versions', table_transformer=aks_versions_table_format)
g.custom_command('get-versions', 'aks_get_versions',
table_transformer=aks_versions_table_format)

# AKS agent pool commands
with self.command_group('aks nodepool', agent_pools_sdk, client_factory=cf_agent_pools) as g:
g.custom_command('list', 'aks_agentpool_list', table_transformer=aks_agentpool_list_table_format)
g.custom_show_command('show', 'aks_agentpool_show', table_transformer=aks_agentpool_show_table_format)
g.custom_command('list', 'aks_agentpool_list',
table_transformer=aks_agentpool_list_table_format)
g.custom_show_command('show', 'aks_agentpool_show',
table_transformer=aks_agentpool_show_table_format)
g.custom_command('add', 'aks_agentpool_add', supports_no_wait=True)
g.custom_command('scale', 'aks_agentpool_scale', supports_no_wait=True)
g.custom_command('upgrade', 'aks_agentpool_upgrade', supports_no_wait=True)
g.custom_command('update', 'aks_agentpool_update', supports_no_wait=True)
g.custom_command('delete', 'aks_agentpool_delete', supports_no_wait=True)
g.custom_command('upgrade', 'aks_agentpool_upgrade',
supports_no_wait=True)
g.custom_command('update', 'aks_agentpool_update',
supports_no_wait=True)
g.custom_command('delete', 'aks_agentpool_delete',
supports_no_wait=True)
g.custom_command('get-upgrades', 'aks_agentpool_get_upgrade_profile')

# OSA commands
Expand All @@ -122,11 +137,14 @@ def load_command_table(self, _):
g.command('delete', 'delete', supports_no_wait=True, confirmation=True)
g.custom_command('scale', 'openshift_scale', supports_no_wait=True)
g.custom_show_command('show', 'openshift_show')
g.custom_command('list', 'osa_list', table_transformer=osa_list_table_format)
g.custom_command('list', 'osa_list',
table_transformer=osa_list_table_format)
g.wait_command('wait')

# OSA monitor subgroup
with self.command_group('openshift monitor', openshift_managed_clusters_sdk,
client_factory=cf_openshift_managed_clusters) as g:
g.custom_command('enable', 'openshift_monitor_enable', supports_no_wait=True)
g.custom_command('disable', 'openshift_monitor_disable', supports_no_wait=True)
g.custom_command('enable', 'openshift_monitor_enable',
supports_no_wait=True)
g.custom_command('disable', 'openshift_monitor_disable',
supports_no_wait=True)
Loading