-
Notifications
You must be signed in to change notification settings - Fork 3.3k
[ACS] BREAKING CHANGE: ARO remove vnet-peer, upgrade to 2019-10-27-preview API version #12240
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
Changes from all commits
e214863
dd9ee7f
5c6e032
7ae4821
ebb7c4f
f4eed0e
b19ecf7
bc513c8
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||
|---|---|---|---|---|
|
|
@@ -42,7 +42,7 @@ def load_command_table(self, _): | |||
| ) | ||||
|
|
||||
| openshift_managed_clusters_sdk = CliCommandType( | ||||
| operations_tmpl='azure.mgmt.containerservice.v2018_09_30_preview.operations.' | ||||
| operations_tmpl='azure.mgmt.containerservice.v2019_10_27_preview.operations.' | ||||
| '_open_shift_managed_clusters_operations#OpenShiftManagedClustersOperations.{}', | ||||
| client_factory=cf_openshift_managed_clusters | ||||
| ) | ||||
|
|
@@ -119,6 +119,7 @@ def load_command_table(self, _): | |||
| with self.command_group('openshift', openshift_managed_clusters_sdk, | ||||
| client_factory=cf_openshift_managed_clusters) as g: | ||||
| g.custom_command('create', 'openshift_create', supports_no_wait=True) | ||||
| g.custom_command('update', 'openshift_update', supports_no_wait=True) | ||||
|
||||
| g.wait_command('wait') |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -68,15 +68,17 @@ | |
| from azure.mgmt.containerservice.v2020_03_01.models import AgentPool | ||
| from azure.mgmt.containerservice.v2020_03_01.models import ManagedClusterSKU | ||
|
|
||
| from azure.mgmt.containerservice.v2019_09_30_preview.models import OpenShiftManagedClusterAgentPoolProfile | ||
| from azure.mgmt.containerservice.v2019_09_30_preview.models import OpenShiftAgentPoolProfileRole | ||
| from azure.mgmt.containerservice.v2019_09_30_preview.models import OpenShiftManagedClusterIdentityProvider | ||
| from azure.mgmt.containerservice.v2019_09_30_preview.models import OpenShiftManagedClusterAADIdentityProvider | ||
| from azure.mgmt.containerservice.v2019_09_30_preview.models import OpenShiftManagedCluster | ||
| from azure.mgmt.containerservice.v2019_09_30_preview.models import OpenShiftRouterProfile | ||
| from azure.mgmt.containerservice.v2019_09_30_preview.models import OpenShiftManagedClusterAuthProfile | ||
| from azure.mgmt.containerservice.v2019_09_30_preview.models import NetworkProfile | ||
| from azure.mgmt.containerservice.v2019_09_30_preview.models import OpenShiftManagedClusterMonitorProfile | ||
| from azure.mgmt.containerservice.v2019_10_27_preview.models import OpenShiftManagedClusterAgentPoolProfile | ||
| from azure.mgmt.containerservice.v2019_10_27_preview.models import OpenShiftManagedClusterMasterPoolProfile | ||
| from azure.mgmt.containerservice.v2019_10_27_preview.models import OpenShiftAgentPoolProfileRole | ||
| from azure.mgmt.containerservice.v2019_10_27_preview.models import OpenShiftManagedClusterIdentityProvider | ||
| from azure.mgmt.containerservice.v2019_10_27_preview.models import OpenShiftManagedClusterAADIdentityProvider | ||
| from azure.mgmt.containerservice.v2019_10_27_preview.models import OpenShiftManagedCluster | ||
| from azure.mgmt.containerservice.v2019_10_27_preview.models import OpenShiftRouterProfile | ||
| from azure.mgmt.containerservice.v2019_10_27_preview.models import OpenShiftManagedClusterAuthProfile | ||
| from azure.mgmt.containerservice.v2019_10_27_preview.models import NetworkProfile | ||
| from azure.mgmt.containerservice.v2019_10_27_preview.models import OpenShiftManagedClusterMonitorProfile | ||
| from azure.mgmt.containerservice.v2019_10_27_preview.models import OpenShiftAPIProperties | ||
|
||
|
|
||
| from ._client_factory import cf_container_services | ||
| from ._client_factory import cf_resource_groups | ||
|
|
@@ -3215,17 +3217,13 @@ def _remove_osa_nulls(managed_clusters): | |
| """ | ||
| attrs = ['tags', 'plan', 'type', 'id'] | ||
| ap_master_attrs = ['name', 'os_type'] | ||
| net_attrs = ['peer_vnet_id'] | ||
| for managed_cluster in managed_clusters: | ||
| for attr in attrs: | ||
| if getattr(managed_cluster, attr, None) is None: | ||
| delattr(managed_cluster, attr) | ||
| for attr in ap_master_attrs: | ||
| if getattr(managed_cluster.master_pool_profile, attr, None) is None: | ||
| delattr(managed_cluster.master_pool_profile, attr) | ||
| for attr in net_attrs: | ||
| if getattr(managed_cluster.network_profile, attr, None) is None: | ||
| delattr(managed_cluster.network_profile, attr) | ||
| return managed_clusters | ||
|
|
||
|
|
||
|
|
@@ -3290,7 +3288,13 @@ def openshift_create(cmd, client, resource_group_name, name, # pylint: disable= | |
| tags=None, | ||
| no_wait=False, | ||
| workspace_id=None, | ||
| customer_admin_group_id=None): | ||
| customer_admin_group_id=None, | ||
| management_subnet_cidr=None, | ||
| private_cluster=None): | ||
|
|
||
| if vnet_peer is not None: | ||
| raise CLIError('Vnet peering is no longer supported during cluster creation.' | ||
| 'Instead it is possible to edit vnet properties after cluster creation') | ||
|
|
||
| if location is None: | ||
| location = _get_rg_location(cmd.cli_ctx, resource_group_name) | ||
|
|
@@ -3304,6 +3308,13 @@ def openshift_create(cmd, client, resource_group_name, name, # pylint: disable= | |
| subnet_cidr=subnet_prefix | ||
| ) | ||
|
|
||
| if bool(private_cluster) != bool(management_subnet_cidr is not None): | ||
| raise CLIError('Both --private-cluster and --management-subnet-cidr need to be supplied or neither.') | ||
|
|
||
| api_properties = OpenShiftAPIProperties( | ||
| private_api_server=bool(private_cluster) | ||
| ) | ||
|
|
||
| agent_infra_pool_profile = OpenShiftManagedClusterAgentPoolProfile( | ||
| name='infra', # Must be 12 chars or less before ACS RP adds to it | ||
| count=int(3), | ||
|
|
@@ -3316,13 +3327,15 @@ def openshift_create(cmd, client, resource_group_name, name, # pylint: disable= | |
| agent_pool_profiles.append(agent_node_pool_profile) | ||
| agent_pool_profiles.append(agent_infra_pool_profile) | ||
|
|
||
| agent_master_pool_profile = OpenShiftManagedClusterAgentPoolProfile( | ||
| agent_master_pool_profile = OpenShiftManagedClusterMasterPoolProfile( | ||
| name='master', # Must be 12 chars or less before ACS RP adds to it | ||
| count=int(3), | ||
| vm_size="Standard_D4s_v3", | ||
| os_type="Linux", | ||
| subnet_cidr=subnet_prefix | ||
| subnet_cidr=subnet_prefix, | ||
| api_properties=api_properties | ||
| ) | ||
|
|
||
| identity_providers = [] | ||
|
|
||
| create_aad = False | ||
|
|
@@ -3351,22 +3364,13 @@ def openshift_create(cmd, client, resource_group_name, name, # pylint: disable= | |
|
|
||
| default_router_profile = OpenShiftRouterProfile(name='default') | ||
|
|
||
| if vnet_peer is not None: | ||
| from msrestazure.tools import is_valid_resource_id, resource_id | ||
| if not is_valid_resource_id(vnet_peer): | ||
| vnet_peer = resource_id( | ||
| subscription=get_subscription_id(cmd.cli_ctx), | ||
| resource_group=resource_group_name, | ||
| namespace='Microsoft.Network', type='virtualNetwork', | ||
| name=vnet_peer | ||
| ) | ||
| if workspace_id is not None: | ||
| workspace_id = _format_workspace_id(workspace_id) | ||
| monitor_profile = OpenShiftManagedClusterMonitorProfile(enabled=True, workspace_resource_id=workspace_id) # pylint: disable=line-too-long | ||
| else: | ||
| monitor_profile = None | ||
|
|
||
| network_profile = NetworkProfile(vnet_cidr=vnet_prefix, peer_vnet_id=vnet_peer) | ||
| network_profile = NetworkProfile(vnet_cidr=vnet_prefix, management_subnet_cidr=management_subnet_cidr) | ||
| osamc = OpenShiftManagedCluster( | ||
| location=location, tags=tags, | ||
| open_shift_version="v3.11", | ||
|
|
@@ -3396,6 +3400,14 @@ def openshift_create(cmd, client, resource_group_name, name, # pylint: disable= | |
| raise ex | ||
|
|
||
|
|
||
| def openshift_update(cmd, client, resource_group_name, name, refresh_cluster=None, no_wait=False): | ||
| instance = client.get(resource_group_name, name) | ||
| if refresh_cluster: | ||
| instance.refresh_cluster = True | ||
|
|
||
| return sdk_no_wait(no_wait, client.create_or_update, resource_group_name, name, instance) | ||
|
|
||
|
|
||
| def openshift_show(cmd, client, resource_group_name, name): | ||
| mc = client.get(resource_group_name, name) | ||
| return _remove_osa_nulls([mc])[0] | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.