Skip to content

Commit f34067a

Browse files
committed
Linting feedback
1 parent 52ae5ce commit f34067a

3 files changed

Lines changed: 111 additions & 4 deletions

File tree

src/aks-preview/azext_aks_preview/_help.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2291,11 +2291,11 @@
22912291
- name: --localdns-config
22922292
type: string
22932293
short-summary: Set the localDNS Profile for a nodepool with a JSON config file.
2294-
- name: --secondary-network-interfaces
2294+
- name: --secondary-network-interfaces --secondary-nics
22952295
type: string
2296-
short-summary: Secondary network interface configurations as a JSON string or @<filename>.
2296+
short-summary: Secondary network interface configurations as a JSON string or `@filename`.
22972297
long-summary: |-
2298-
Specify secondary NICs to attach to each node. Accepts inline JSON or @<filename>.
2298+
Specify secondary NICs to attach to each node. Accepts inline JSON or `@filename`.
22992299
Example: '[{"type":"Standard","vnetSubnetId":"/subscriptions/.../subnets/mysubnet","enableAcceleratedNetworking":true}]'
23002300
Supported NIC types are "Standard" (requires vnetSubnetId) and "Dynamic".
23012301
- name: --upgrade-strategy

src/aks-preview/azext_aks_preview/_params.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2211,7 +2211,8 @@ def load_arguments(self, _):
22112211
# secondary network interfaces
22122212
c.argument(
22132213
'secondary_network_interfaces',
2214-
help='Secondary network interface configurations as a JSON string or @<filename> to load from a file. '
2214+
options_list=['--secondary-network-interfaces', '--secondary-nics'],
2215+
help='Secondary network interface configurations as a JSON string or `@filename` to load from a file. '
22152216
'Example: \'[{"type":"Standard","vnetSubnetId":"/subscriptions/.../subnets/mysubnet"}]\'',
22162217
is_preview=True,
22172218
)

src/aks-preview/azext_aks_preview/tests/latest/test_aks_commands.py

Lines changed: 106 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16906,6 +16906,112 @@ def test_aks_nodepool_create_with_nsg_control(
1690616906
],
1690716907
)
1690816908

16909+
@AllowLargeResponse()
16910+
@AKSCustomResourceGroupPreparer(
16911+
random_name_length=17, name_prefix="clitest", location="eastus"
16912+
)
16913+
def test_aks_nodepool_add_with_secondary_network_interfaces(
16914+
self, resource_group, resource_group_location
16915+
):
16916+
aks_name = self.create_random_name("cliakstest", 16)
16917+
nodepool_name = self.create_random_name("n", 6)
16918+
16919+
self.kwargs.update(
16920+
{
16921+
"resource_group": resource_group,
16922+
"name": aks_name,
16923+
"location": resource_group_location,
16924+
"ssh_key_value": self.generate_ssh_keys(),
16925+
"node_pool_name": nodepool_name,
16926+
"node_vm_size": "standard_d8s_v3",
16927+
}
16928+
)
16929+
16930+
# Create a VNet with subnets for nodes and secondary NICs
16931+
self.cmd(
16932+
"network vnet create "
16933+
"--resource-group={resource_group} "
16934+
"--name=testvnet "
16935+
"--address-prefix 10.0.0.0/16",
16936+
)
16937+
self.cmd(
16938+
"network vnet subnet create "
16939+
"--resource-group={resource_group} "
16940+
"--vnet-name=testvnet "
16941+
"--name=nodesubnet "
16942+
"--address-prefix 10.0.0.0/24",
16943+
)
16944+
subnet = self.cmd(
16945+
"network vnet subnet create "
16946+
"--resource-group={resource_group} "
16947+
"--vnet-name=testvnet "
16948+
"--name=secondarysubnet "
16949+
"--address-prefix 10.0.1.0/24",
16950+
).get_output_in_json()
16951+
16952+
node_subnet_id = (
16953+
f"/subscriptions/{self.get_subscription_id()}"
16954+
f"/resourceGroups/{resource_group}"
16955+
"/providers/Microsoft.Network/virtualNetworks/testvnet/subnets/nodesubnet"
16956+
)
16957+
secondary_subnet_id = subnet["id"]
16958+
16959+
self.kwargs.update(
16960+
{
16961+
"node_subnet_id": node_subnet_id,
16962+
"secondary_nics": f'[{{"type":"Standard","vnetSubnetId":"{secondary_subnet_id}"}}]',
16963+
}
16964+
)
16965+
16966+
# Create the cluster
16967+
self.cmd(
16968+
"aks create "
16969+
"--resource-group={resource_group} "
16970+
"--name={name} "
16971+
"--location={location} "
16972+
"--ssh-key-value={ssh_key_value} "
16973+
"--node-count=1 "
16974+
"--node-vm-size={node_vm_size} "
16975+
"--vnet-subnet-id={node_subnet_id} ",
16976+
checks=[
16977+
self.check("provisioningState", "Succeeded"),
16978+
],
16979+
)
16980+
16981+
# Add nodepool with secondary network interfaces
16982+
self.cmd(
16983+
"aks nodepool add "
16984+
"--resource-group={resource_group} "
16985+
"--cluster-name={name} "
16986+
"--name={node_pool_name} "
16987+
"--node-vm-size={node_vm_size} "
16988+
"--node-count=1 "
16989+
"--vnet-subnet-id={node_subnet_id} "
16990+
"--secondary-network-interfaces '{secondary_nics}' ",
16991+
checks=[
16992+
self.check("provisioningState", "Succeeded"),
16993+
self.check(
16994+
"networkProfile.secondaryNetworkInterfaces[0].vnetSubnetId",
16995+
secondary_subnet_id,
16996+
),
16997+
self.check(
16998+
"networkProfile.secondaryNetworkInterfaces[0].type",
16999+
"Standard",
17000+
),
17001+
],
17002+
)
17003+
17004+
# delete
17005+
cmd = (
17006+
"aks delete --resource-group={resource_group} --name={name} --yes --no-wait"
17007+
)
17008+
self.cmd(
17009+
cmd,
17010+
checks=[
17011+
self.is_empty(),
17012+
],
17013+
)
17014+
1690917015
@AllowLargeResponse()
1691017016
@AKSCustomResourceGroupPreparer(
1691117017
random_name_length=17, name_prefix="clitest", location="eastus"

0 commit comments

Comments
 (0)