Skip to content

Commit 1f325ef

Browse files
committed
resolve code conflicts
2 parents f6aa010 + 328b744 commit 1f325ef

File tree

174 files changed

+122595
-77266
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

174 files changed

+122595
-77266
lines changed

src/azure-cli/azure/cli/command_modules/acs/_client_factory.py

+4
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,10 @@ def cf_managed_clusters(cli_ctx, *_):
2727
return get_container_service_client(cli_ctx).managed_clusters
2828

2929

30+
def cf_machines(cli_ctx, *_):
31+
return get_container_service_client(cli_ctx).machines
32+
33+
3034
def cf_maintenance_configurations(cli_ctx, *_):
3135
return get_container_service_client(cli_ctx).maintenance_configurations
3236

src/azure-cli/azure/cli/command_modules/acs/_format.py

+18
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,24 @@ def aks_list_table_format(results):
4141
return [_aks_table_format(r) for r in results]
4242

4343

44+
def aks_machine_list_table_format(results):
45+
return [aks_machine_show_table_format(r) for r in results]
46+
47+
48+
def aks_machine_show_table_format(result):
49+
def parser(entry):
50+
ip_addresses = ""
51+
for k in entry["properties"]["network"]["ipAddresses"]:
52+
ip_addresses += "ip:" + k["ip"] + "," + "family:" + k["family"] + ";"
53+
entry["ip"] = ip_addresses
54+
parsed = compile_jmes("""{
55+
name: name,
56+
ip: ip
57+
}""")
58+
return parsed.search(entry, Options(dict_cls=OrderedDict))
59+
return parser(result)
60+
61+
4462
def aks_run_command_result_format(cmdResult):
4563
result = OrderedDict()
4664
if cmdResult['provisioningState'] == "Succeeded":

src/azure-cli/azure/cli/command_modules/acs/_help.py

+36
Original file line numberDiff line numberDiff line change
@@ -2485,3 +2485,39 @@
24852485
short-summary: List DNS Zone IDs in App Routing.
24862486
long-summary: This command lists the DNS zone resources used in App Routing.
24872487
"""
2488+
2489+
helps['aks machine'] = """
2490+
type: group
2491+
short-summary: Get information about machines in a nodepool of a managed clusters
2492+
"""
2493+
helps['aks machine list'] = """
2494+
type: command
2495+
short-summary: Get information about IP Addresses, Hostname for all machines in an agentpool
2496+
parameters:
2497+
- name: --cluster-name
2498+
type: string
2499+
short-summary: Name of the managed cluster
2500+
- name: --nodepool-name
2501+
type: string
2502+
short-summary: Name of the agentpool of a managed cluster
2503+
exmaples:
2504+
- name: Get information about IP Addresses, Hostname for all machines in an agentpool
2505+
text: az aks machine list --cluster-name <clusterName> --nodepool-name <apName>
2506+
"""
2507+
helps['aks machine show'] = """
2508+
type: command
2509+
short-summary: Show IP Addresses, Hostname for a specific machine in an agentpool for a managedcluster.
2510+
parameters:
2511+
- name: --cluster-name
2512+
type: string
2513+
short-summary: Name of the managed cluster
2514+
- name: --nodepool-name
2515+
type: string
2516+
short-summary: Name of the agentpool of a managed cluster
2517+
- name: --machine-name
2518+
type: string
2519+
short-summary: Name of the machine in the agentpool of a managed cluster
2520+
exmaples:
2521+
- name: Get IP Addresses, Hostname for a specific machine in an agentpool
2522+
text: az aks machine show --cluster-name <clusterName> --nodepool-name <apName> --machine-name <machineName>
2523+
"""

src/azure-cli/azure/cli/command_modules/acs/_params.py

+7
Original file line numberDiff line numberDiff line change
@@ -701,6 +701,13 @@ def load_arguments(self, _):
701701
c.argument('acr', validator=validate_registry_name)
702702
c.argument('node_name')
703703

704+
with self.argument_context('aks machine') as c:
705+
c.argument('cluster_name')
706+
c.argument('nodepool_name', validator=validate_nodepool_name)
707+
708+
with self.argument_context('aks machine show') as c:
709+
c.argument('machine_name')
710+
704711
with self.argument_context('aks maintenanceconfiguration') as c:
705712
c.argument('cluster_name', help='The cluster name.')
706713

src/azure-cli/azure/cli/command_modules/acs/_validators.py

+14
Original file line numberDiff line numberDiff line change
@@ -783,13 +783,27 @@ def validate_allowed_host_ports(namespace):
783783

784784

785785
def validate_application_security_groups(namespace):
786+
is_nodepool_operation = False
786787
if hasattr((namespace), "nodepool_asg_ids"):
788+
is_nodepool_operation = True
787789
asg_ids = namespace.nodepool_asg_ids
790+
host_ports = namespace.nodepool_allowed_host_ports
788791
else:
789792
asg_ids = namespace.asg_ids
793+
host_ports = namespace.allowed_host_ports
794+
790795
if not asg_ids:
791796
return
792797

798+
if not host_ports:
799+
if is_nodepool_operation:
800+
raise ArgumentUsageError(
801+
'--nodepool-asg-ids must be used with --nodepool-allowed-host-ports'
802+
)
803+
raise ArgumentUsageError(
804+
'--asg-ids must be used with --allowed-host-ports'
805+
)
806+
793807
from azure.mgmt.core.tools import is_valid_resource_id
794808
for asg in asg_ids:
795809
if not is_valid_resource_id(asg):

src/azure-cli/azure/cli/command_modules/acs/commands.py

+15
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
cf_snapshots,
1111
cf_trustedaccess_role,
1212
cf_trustedaccess_role_binding,
13+
cf_machines
1314
)
1415
from azure.cli.command_modules.acs._format import (
1516
aks_agentpool_list_table_format,
@@ -23,6 +24,8 @@
2324
aks_versions_table_format,
2425
aks_mesh_revisions_table_format,
2526
aks_mesh_upgrades_table_format,
27+
aks_machine_list_table_format,
28+
aks_machine_show_table_format,
2629
)
2730
from azure.cli.core.commands import CliCommandType
2831
from azure.cli.core.profiles import ResourceType
@@ -48,6 +51,12 @@ def load_command_table(self, _):
4851
client_factory=cf_managed_clusters
4952
)
5053

54+
machines_sdk = CliCommandType(
55+
operations_tmpl='azext_aks_preview.vendored_sdks.azure_mgmt_preview_aks.'
56+
'operations._machine_operations#MachinesOperations.{}',
57+
client_factory=cf_managed_clusters
58+
)
59+
5160
maintenance_configuration_sdk = CliCommandType(
5261
operations_tmpl='aazure.mgmt.containerservice.operations.'
5362
'_maintenance_configurations_operations#MaintenanceConfigurationsOperations.{}',
@@ -110,6 +119,12 @@ def load_command_table(self, _):
110119
g.custom_command('get-versions', 'aks_get_versions',
111120
table_transformer=aks_versions_table_format)
112121

122+
with self.command_group('aks machine', machines_sdk, client_factory=cf_machines) as g:
123+
g.custom_command('list', 'aks_machine_list',
124+
table_transformer=aks_machine_list_table_format)
125+
g.custom_show_command('show', 'aks_machine_show',
126+
table_transformer=aks_machine_show_table_format)
127+
113128
# AKS maintenance configuration commands
114129
with self.command_group('aks maintenanceconfiguration', maintenance_configuration_sdk, client_factory=cf_maintenance_configurations) as g:
115130
g.custom_command('list', 'aks_maintenanceconfiguration_list')

src/azure-cli/azure/cli/command_modules/acs/custom.py

+12-2
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,9 @@
3535
import colorama
3636
import requests
3737
import yaml
38-
from azure.cli.command_modules.acs._client_factory import cf_agent_pools
38+
from azure.cli.command_modules.acs._client_factory import (
39+
cf_agent_pools
40+
)
3941
from azure.cli.command_modules.acs._consts import (
4042
ADDONS,
4143
CONST_ACC_SGX_QUOTE_HELPER_ENABLED,
@@ -358,6 +360,14 @@ def which(binary):
358360
return None
359361

360362

363+
def aks_machine_list(cmd, client, resource_group_name, cluster_name, nodepool_name):
364+
return client.list(resource_group_name, cluster_name, nodepool_name)
365+
366+
367+
def aks_machine_show(cmd, client, resource_group_name, cluster_name, nodepool_name, machine_name):
368+
return client.get(resource_group_name, cluster_name, nodepool_name, machine_name)
369+
370+
361371
def aks_maintenanceconfiguration_list(
362372
cmd,
363373
client,
@@ -2570,7 +2580,7 @@ def aks_agentpool_upgrade(cmd, client, resource_group_name, cluster_name,
25702580
instance.upgrade_settings.max_surge = max_surge
25712581
if drain_timeout:
25722582
instance.upgrade_settings.drain_timeout_in_minutes = drain_timeout
2573-
if node_soak_duration:
2583+
if isinstance(node_soak_duration, int) and node_soak_duration >= 0:
25742584
instance.upgrade_settings.node_soak_duration_in_minutes = node_soak_duration
25752585

25762586
# custom headers

0 commit comments

Comments
 (0)