Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
0ea0e1a
[Backup] Migrate backup to track2 SDK
Jing-song Apr 23, 2021
2d08413
[Backup] Migrate backup to track2 SDK
Jing-song Apr 23, 2021
21df44d
Merge branch 'backup' of https://github.com/PARADISSEEKR/azure-cli in…
Jing-song Apr 23, 2021
ce7ec89
[Backup] Migrate backup to track2 SDK
Jing-song Apr 23, 2021
6ec1be7
Merge branch 'dev' into backup
Jing-song Apr 27, 2021
cbff591
workload_test
Jing-song May 11, 2021
2153a31
workload_sql
Jing-song May 11, 2021
8e2acda
Merge branch 'dev' into backup
Jing-song May 11, 2021
d4b7343
update
Jing-song May 11, 2021
e98fad3
workload_hana
Jing-song May 13, 2021
cd27f08
update afs_test
Jing-song May 13, 2021
10b1d7d
update
Jing-song May 14, 2021
a197e3c
Merge branch 'dev' into backup
Jing-song May 17, 2021
6d4ce96
Revert "Merge branch 'dev' into backup"
Jing-song May 17, 2021
c6ffee9
Modified style
Jing-song May 17, 2021
ac677d3
Merge branch 'dev' into backup
Jing-song May 20, 2021
815bb07
update
Jing-song May 20, 2021
7eecf22
Merge branch 'dev' into backup
Jing-song May 20, 2021
647041f
fix conflicts
Jing-song May 20, 2021
c3b97d0
update
Jing-song May 20, 2021
cffb783
update
Jing-song May 20, 2021
61c44bf
update
Jing-song May 20, 2021
8a619b5
Merge branch 'dev' into backup
Jing-song May 20, 2021
934a554
update
Jing-song May 26, 2021
76c4c64
Merge branch 'dev' into backup
Jing-song May 26, 2021
e0ce5f9
Apply suggestions from code review
Jing-song May 26, 2021
e06fad1
Update preparers.py
Jing-song May 27, 2021
034b326
Resolve conflicts
Jing-song May 28, 2021
2f32c51
Revert "Resolve conflicts"
Jing-song May 28, 2021
6d5f01d
Resolve conflicts
Jing-song May 28, 2021
3e7564b
Merge branch 'Azure:dev' into backup
Jing-song May 28, 2021
230b842
Update test_backup_wl_sql_policy.yaml
Jing-song May 28, 2021
54bfb1c
Delete test_acs_create_kubernetes.yaml
Jing-song May 31, 2021
dae3426
Merge branch 'Azure:dev' into backup
Jing-song May 31, 2021
a344460
Merge branch 'Azure:dev' into backup
Jing-song May 31, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
Prev Previous commit
Next Next commit
update
  • Loading branch information
Jing-song committed May 20, 2021
commit cffb78388efe8815f28923364fd2fd1a6e58bb42
21 changes: 19 additions & 2 deletions src/azure-cli/azure/cli/command_modules/acs/_format.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,21 @@ def aks_list_table_format(results):
return [_aks_table_format(r) for r in results]


def aks_run_command_result_format(cmdResult):
result = OrderedDict()
if cmdResult['provisioningState'] == "Succeeded":
result['exit code'] = cmdResult['exitCode']
result['logs'] = cmdResult['logs']
return result
if cmdResult['provisioningState'] == "Failed":
result['provisioning state'] = cmdResult['provisioningState']
result['reason'] = cmdResult['reason']
return result
result['provisioning state'] = cmdResult['provisioningState']
result['started At'] = cmdResult['startedAt']
return result


def osa_list_table_format(results):
""""Format a list of OpenShift managed clusters as summary results for display with "-o table"."""
return [_osa_table_format(r) for r in results]
Expand Down Expand Up @@ -116,7 +131,8 @@ def find_preview_versions():
}""")

# use ordered dicts so headers are predictable
results = parsed.search(result, Options(dict_cls=OrderedDict, custom_functions=_custom_functions(preview)))
results = parsed.search(result, Options(
dict_cls=OrderedDict, custom_functions=_custom_functions(preview)))
return sorted(results, key=lambda x: version_to_tuple(x.get('kubernetesVersion')), reverse=True)


Expand All @@ -135,7 +151,8 @@ def _func_sort_versions(self, versions): # pylint: disable=no-self-use
"""Custom JMESPath `sort_versions` function that sorts an array of strings as software versions."""
try:
return sorted(versions, key=version_to_tuple)
except (TypeError, ValueError): # if it wasn't sortable, return the input so the pipeline continues
# if it wasn't sortable, return the input so the pipeline continues
except (TypeError, ValueError):
return versions

@functions.signature({'types': ['array']})
Expand Down
43 changes: 43 additions & 0 deletions src/azure-cli/azure/cli/command_modules/acs/_help.py
Original file line number Diff line number Diff line change
Expand Up @@ -440,6 +440,9 @@
- name: --enable-encryption-at-host
type: bool
short-summary: Enable EncryptionAtHost, default value is false.
- name: --enable-azure-rbac
type: bool
short-summary: Enable Azure RBAC to control authorization checks on cluster.
examples:
- name: Create a Kubernetes cluster with an existing SSH public key.
text: az aks create -g MyResourceGroup -n MyManagedCluster --ssh-key-value /path/to/publickey
Expand Down Expand Up @@ -479,6 +482,8 @@
text: az aks create -g MyResourceGroup -n MyManagedCluster --node-osdisk-type Ephemeral --node-osdisk-size 48
- name: Create a kubernetes cluster with EncryptionAtHost enabled.
text: az aks create -g MyResourceGroup -n MyManagedCluster --enable-encryption-at-host
- name: Create a kubernetes cluster with Azure RBAC enabled.
text: az aks create -g MyResourceGroup -n MyManagedCluster --enable-aad --enable-azure-rbac
"""

helps['aks update'] = """
Expand Down Expand Up @@ -570,6 +575,12 @@
- name: --assign-identity
type: string
short-summary: Specify an existing user assigned identity to manage cluster resource group.
- name: --enable-azure-rbac
type: bool
short-summary: Enable Azure RBAC to control authorization checks on cluster.
- name: --disable-azure-rbac
type: bool
short-summary: Disable Azure RBAC to control authorization checks on cluster.
examples:
- name: Update a kubernetes cluster with standard SKU load balancer to use two AKS created IPs for the load balancer outbound connection usage.
text: az aks update -g MyResourceGroup -n MyManagedCluster --load-balancer-managed-outbound-ip-count 2
Expand Down Expand Up @@ -601,6 +612,12 @@
text: az aks update -g MyResourceGroup -n MyManagedCluster --enable-managed-identity
- name: Update the cluster to use user assigned managed identity in control plane.
text: az aks update -g MyResourceGroup -n MyManagedCluster --enable-managed-identity --assign-identity <user_assigned_identity_resource_id>
- name: Update a non managed AAD AKS cluster to use Azure RBAC
text: az aks update -g MyResourceGroup -n MyManagedCluster --enable-aad --enable-azure-rbac
- name: Update a managed AAD AKS cluster to use Azure RBAC
text: az aks update -g MyResourceGroup -n MyManagedCluster --enable-azure-rbac
- name: Disable Azure RBAC in a managed AAD AKS cluster
text: az aks update -g MyResourceGroup -n MyManagedCluster --disable-azure-rbac
"""

helps['aks delete'] = """
Expand Down Expand Up @@ -1038,6 +1055,32 @@
long-summary: Kubernetes will be unavailable during cluster certificate rotation.
"""

helps['aks command'] = """
type: group
short-summary: See detail usage in 'az aks command invoke', 'az aks command result'.
"""

helps['aks command invoke'] = """
type: command
short-summary: Run a shell command (with kubectl, helm) on your aks cluster, support attaching files as well.
parameters:
- name: --command -c
type: string
short-summary: Command or shell script you want to run.
- name: --file -f
type: string
short-summary: Files to be used by the command, use '.' to attach the current folder.
"""

helps['aks command result'] = """
type: command
short-summary: Fetch result from previously triggered 'aks command invoke'.
parameters:
- name: --command-id -i
type: string
short-summary: commandId returned from 'aks command invoke'.
"""

helps['openshift'] = """
type: group
short-summary: Manage Azure Red Hat OpenShift 3.11 clusters.
Expand Down
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
Loading