Skip to content
Merged
Show file tree
Hide file tree
Changes from 14 commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
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
4 changes: 4 additions & 0 deletions src/aks-preview/HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ Pending
+++++++
* Add machine command `az aks machine add` to add a machine to an existing machine pool.

18.0.0b38
+++++++
* Add option `--acns-datapath-acceleration-mode <None|BpfVeth>` to `az aks create/update`

18.0.0b37
+++++++
* Enable autoscaler support for the VirtualMachines agent pool type.
Expand Down
4 changes: 4 additions & 0 deletions src/aks-preview/azext_aks_preview/_consts.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,10 @@
CONST_TRANSIT_ENCRYPTION_TYPE_NONE = "None"
CONST_TRANSIT_ENCRYPTION_TYPE_WIREGUARD = "WireGuard"

# ACNS performance acceleration mode
CONST_ACNS_DATAPATH_ACCELERATION_MODE_NONE = "None"
CONST_ACNS_DATAPATH_ACCELERATION_MODE_BPFVETH = "BpfVeth"

# network pod ip allocation mode
CONST_NETWORK_POD_IP_ALLOCATION_MODE_DYNAMIC_INDIVIDUAL = "DynamicIndividual"
CONST_NETWORK_POD_IP_ALLOCATION_MODE_STATIC_BLOCK = "StaticBlock"
Expand Down
6 changes: 6 additions & 0 deletions src/aks-preview/azext_aks_preview/_help.py
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,9 @@
- name: --acns-advanced-networkpolicies
type: string
short-summary: Used to enable advanced network policies (None, FQDN or L7) on a cluster when enabling advanced networking features with "--enable-acns".
- name: --acns-datapath-acceleration-mode
type: string
short-summary: Used to set the acceleration mode (None or BpfVeth) on a cluster when enabling advanced networking features with "--enable-acns".
- name: --enable-retina-flow-logs
type: bool
short-summary: Enable advanced network flow log collection functionalities on a cluster.
Expand Down Expand Up @@ -1244,6 +1247,9 @@
- name: --acns-advanced-networkpolicies
type: string
short-summary: Used to enable advanced network policies (None, FQDN or L7) on a cluster when enabling advanced networking features with "--enable-acns".
- name: --acns-datapath-acceleration-mode
type: string
short-summary: Used to set the acceleration mode (None or BpfVeth) on a cluster when enabling advanced networking features with "--enable-acns".
- name: --enable-retina-flow-logs
type: bool
short-summary: Enable advanced network flow log collection functionalities on a cluster.
Expand Down
18 changes: 18 additions & 0 deletions src/aks-preview/azext_aks_preview/_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,8 @@
CONST_ADVANCED_NETWORKPOLICIES_L7,
CONST_TRANSIT_ENCRYPTION_TYPE_NONE,
CONST_TRANSIT_ENCRYPTION_TYPE_WIREGUARD,
CONST_ACNS_DATAPATH_ACCELERATION_MODE_BPFVETH,
CONST_ACNS_DATAPATH_ACCELERATION_MODE_NONE
)

from azext_aks_preview._validators import (
Expand Down Expand Up @@ -339,6 +341,10 @@
CONST_TRANSIT_ENCRYPTION_TYPE_NONE,
CONST_TRANSIT_ENCRYPTION_TYPE_WIREGUARD,
]
acns_datapath_acceleration_modes = [
CONST_ACNS_DATAPATH_ACCELERATION_MODE_NONE,
CONST_ACNS_DATAPATH_ACCELERATION_MODE_BPFVETH,
]
network_dataplanes = [CONST_NETWORK_DATAPLANE_AZURE, CONST_NETWORK_DATAPLANE_CILIUM]
disk_driver_versions = [CONST_DISK_DRIVER_V1, CONST_DISK_DRIVER_V2]
outbound_types = [
Expand Down Expand Up @@ -914,6 +920,12 @@ def load_arguments(self, _):
is_preview=True,
arg_type=get_enum_type(advanced_networkpolicies),
)
c.argument(
"acns_datapath_acceleration_mode",
is_preview=True,
arg_type=get_enum_type(acns_datapath_acceleration_modes),
help="Specify the performance acceleration mode for ACNS. Available values are 'None' and 'BpfVeth'.",
)
c.argument(
"acns_transit_encryption_type",
is_preview=True,
Expand Down Expand Up @@ -1433,6 +1445,12 @@ def load_arguments(self, _):
is_preview=True,
arg_type=get_enum_type(advanced_networkpolicies),
)
c.argument(
"acns_datapath_acceleration_mode",
is_preview=True,
arg_type=get_enum_type(acns_datapath_acceleration_modes),
help="Specify the performance acceleration mode for ACNS. Available values are 'None' and 'BpfVeth'.",
)
c.argument(
"acns_transit_encryption_type",
is_preview=True,
Expand Down
2 changes: 2 additions & 0 deletions src/aks-preview/azext_aks_preview/custom.py
Original file line number Diff line number Diff line change
Expand Up @@ -700,6 +700,7 @@ def aks_create(
acns_advanced_networkpolicies=None,
acns_transit_encryption_type=None,
enable_retina_flow_logs=None,
acns_datapath_acceleration_mode=None,
# nodepool
crg_id=None,
message_of_the_day=None,
Expand Down Expand Up @@ -942,6 +943,7 @@ def aks_update(
acns_transit_encryption_type=None,
enable_retina_flow_logs=None,
disable_retina_flow_logs=None,
acns_datapath_acceleration_mode=None,
# metrics profile
enable_cost_analysis=False,
disable_cost_analysis=False,
Expand Down
59 changes: 52 additions & 7 deletions src/aks-preview/azext_aks_preview/managed_cluster_decorator.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@
CONST_IMDS_RESTRICTION_DISABLED,
CONST_AVAILABILITY_SET,
CONST_VIRTUAL_MACHINES,
CONST_ACNS_DATAPATH_ACCELERATION_MODE_BPFVETH,
CONST_ACNS_DATAPATH_ACCELERATION_MODE_NONE
)
from azext_aks_preview._helpers import (
check_is_apiserver_vnet_integration_cluster,
Expand Down Expand Up @@ -760,15 +762,27 @@ def get_enable_cilium_dataplane(self) -> bool:
def get_acns_enablement(self) -> Tuple[
Union[bool, None],
Union[bool, None],
Union[bool, None],
Union[bool, None]
]:
"""Get the enablement of acns
"""Get the enablement of acns (not including the performance suite)
:return: Tuple of 3 elements which can be bool or None
"""
enable_acns, enable_acns_observability, enable_acns_security, _ = self.get_acns_enablement_with_perf()
return enable_acns, enable_acns_observability, enable_acns_security

def get_acns_enablement_with_perf(self) -> Tuple[
Union[bool, None],
Union[bool, None],
Union[bool, None],
Union[bool, None]
]:
"""Get the enablement of acns including the performance suite
:return: Tuple of 4 elements which can be bool or None
"""
enable_acns = self.raw_param.get("enable_acns")
disable_acns = self.raw_param.get("disable_acns")
if enable_acns is None and disable_acns is None:
return None, None, None
return None, None, None, None
if enable_acns and disable_acns:
raise MutuallyExclusiveArgumentError(
"Cannot specify --enable-acns and "
Expand All @@ -778,17 +792,22 @@ def get_acns_enablement(self) -> Tuple[
disable_acns = bool(disable_acns) if disable_acns is not None else False
acns = enable_acns or not disable_acns
acns_observability = self.get_acns_observability()
acns_datapath_acceleration_mode = self.get_acns_datapath_acceleration_mode()
acns_perf_enabled = None
if acns_datapath_acceleration_mode is not None:
acns_perf_enabled = acns_datapath_acceleration_mode == CONST_ACNS_DATAPATH_ACCELERATION_MODE_BPFVETH
acns_security = self.get_acns_security()
if acns and (acns_observability is False and acns_security is False):
if acns and (acns_observability is False and acns_security is False and acns_perf_enabled is not True):
Comment thread
santhoshmprabhu marked this conversation as resolved.
raise MutuallyExclusiveArgumentError(
"Cannot disable both observability and security when enabling ACNS. "
"Cannot disable observability, security, and performance acceleration when enabling ACNS. "
"Please enable at least one of them or disable ACNS with --disable-acns."
)
if not acns and (acns_observability is not None or acns_security is not None):
if not acns and (acns_observability is not None or acns_security is not None
or acns_datapath_acceleration_mode is not None):
raise MutuallyExclusiveArgumentError(
"--disable-acns does not use any additional acns arguments."
)
return acns, acns_observability, acns_security
return acns, acns_observability, acns_security, acns_perf_enabled

def get_acns_observability(self) -> Union[bool, None]:
"""Get the enablement of acns observability
Expand Down Expand Up @@ -823,6 +842,21 @@ def get_acns_advanced_networkpolicies(self) -> Union[str, None]:
)
return self.raw_param.get("acns_advanced_networkpolicies")

def get_acns_datapath_acceleration_mode(self) -> Union[str, None]:
"""Get the value of acns_datapath_acceleration_mode

:return: str or None
"""
disable_acns = self.raw_param.get("disable_acns")
acns_datapath_acceleration_mode = self.raw_param.get("acns_datapath_acceleration_mode")
if (acns_datapath_acceleration_mode is not None
and acns_datapath_acceleration_mode != CONST_ACNS_DATAPATH_ACCELERATION_MODE_NONE):
if disable_acns:
raise MutuallyExclusiveArgumentError(
"--disable-acns cannot be used with --acns-performance-acceleration-mode."
)
return acns_datapath_acceleration_mode

def get_acns_transit_encryption_type(self) -> Union[str, None]:
"""Get the value of acns_transit_encryption_type

Expand Down Expand Up @@ -3107,6 +3141,7 @@ def set_up_network_profile(self, mc: ManagedCluster) -> ManagedCluster:
(acns_enabled, acns_observability_enabled, acns_security_enabled) = self.context.get_acns_enablement()
acns_advanced_networkpolicies = self.context.get_acns_advanced_networkpolicies()
acns_transit_encryption_type = self.context.get_acns_transit_encryption_type()
acns_datapath_acceleration_mode = self.context.get_acns_datapath_acceleration_mode()
if acns_enabled is not None:
acns = self.models.AdvancedNetworking(
enabled=acns_enabled,
Expand All @@ -3132,6 +3167,11 @@ def set_up_network_profile(self, mc: ManagedCluster) -> ManagedCluster:
if acns.security.transit_encryption is None:
acns.security.transit_encryption = self.models.AdvancedNetworkingSecurityTransitEncryption()
acns.security.transit_encryption.type = acns_transit_encryption_type
if acns_datapath_acceleration_mode == CONST_ACNS_DATAPATH_ACCELERATION_MODE_BPFVETH:
if acns.performance is None:
acns.performance = self.models.AdvancedNetworkingPerformance()
acns.performance.acceleration_mode = acns_datapath_acceleration_mode

network_profile.advanced_networking = acns
return mc

Expand Down Expand Up @@ -4306,6 +4346,7 @@ def update_acns_in_network_profile(self, mc: ManagedCluster) -> ManagedCluster:
(acns_enabled, acns_observability_enabled, acns_security_enabled) = self.context.get_acns_enablement()
acns_advanced_networkpolicies = self.context.get_acns_advanced_networkpolicies()
acns_transit_encryption_type = self.context.get_acns_transit_encryption_type()
acns_datapath_acceleration_mode = self.context.get_acns_datapath_acceleration_mode()
if acns_enabled is not None:
acns = self.models.AdvancedNetworking(
enabled=acns_enabled,
Expand All @@ -4331,6 +4372,10 @@ def update_acns_in_network_profile(self, mc: ManagedCluster) -> ManagedCluster:
if acns.security.transit_encryption is None:
acns.security.transit_encryption = self.models.AdvancedNetworkingSecurityTransitEncryption()
acns.security.transit_encryption.type = acns_transit_encryption_type
if acns_datapath_acceleration_mode == CONST_ACNS_DATAPATH_ACCELERATION_MODE_BPFVETH:
if acns.performance is None:
acns.performance = self.models.AdvancedNetworkingPerformance()
acns.performance.acceleration_mode = acns_datapath_acceleration_mode
mc.network_profile.advanced_networking = acns
return mc

Expand Down
108 changes: 72 additions & 36 deletions src/aks-preview/azext_aks_preview/tests/latest/test_aks_commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -2924,42 +2924,6 @@ def test_aks_nodepool_add_with_ossku_ubuntu2204(self, resource_group, resource_g
self.cmd(
'aks delete -g {resource_group} -n {name} --yes --no-wait', checks=[self.is_empty()])

@AllowLargeResponse()
@AKSCustomResourceGroupPreparer(random_name_length=17, name_prefix='clitest', location='eastus2euap')
def test_aks_nodepool_add_with_ossku_azurelinux3(self, resource_group, resource_group_location):
Comment thread
santhoshmprabhu marked this conversation as resolved.
aks_name = self.create_random_name('cliakstest', 16)
node_pool_name = self.create_random_name('c', 6)
node_pool_name_second = self.create_random_name('c', 6)
self.kwargs.update({
'resource_group': resource_group,
'name': aks_name,
'node_pool_name': node_pool_name,
'node_pool_name_second': node_pool_name_second,
'ssh_key_value': self.generate_ssh_keys()
})

create_cmd = 'aks create --resource-group={resource_group} --name={name} ' \
'--nodepool-name {node_pool_name} -c 1 ' \
'--ssh-key-value={ssh_key_value}'
self.cmd(create_cmd, checks=[
self.check('provisioningState', 'Succeeded'),
])

# nodepool get-upgrades
self.cmd('aks nodepool add '
'--resource-group={resource_group} '
'--cluster-name={name} '
'--name={node_pool_name_second} '
'--os-sku AzureLinux3',
checks=[
self.check('provisioningState', 'Succeeded'),
self.check('osSku', 'AzureLinux3'),
])

# delete
self.cmd(
'aks delete -g {resource_group} -n {name} --yes --no-wait', checks=[self.is_empty()])

@AllowLargeResponse()
@AKSCustomResourceGroupPreparer(
random_name_length=17, name_prefix="clitest", location="westus2"
Expand Down Expand Up @@ -13978,6 +13942,7 @@ def test_aks_update_enable_acns(
self.check("networkProfile.advancedNetworking.enabled", True),
self.check("networkProfile.advancedNetworking.observability.enabled", True),
self.check("networkProfile.advancedNetworking.security.enabled", True),
self.check("networkProfile.advancedNetworking.performance.accelerationMode", "None"),
],
)

Expand Down Expand Up @@ -14092,6 +14057,7 @@ def test_aks_create_with_advanced_networkpolicies(
self.check("provisioningState", "Succeeded"),
self.check("networkProfile.advancedNetworking.enabled", True),
self.check("networkProfile.advancedNetworking.observability.enabled", True),
self.check("networkProfile.advancedNetworking.performance.accelerationMode", "None"),
self.check("networkProfile.advancedNetworking.security.enabled", True),
self.check("networkProfile.advancedNetworking.security.advancedNetworkPolicies", "L7"),
],
Expand Down Expand Up @@ -14339,6 +14305,76 @@ def test_aks_update_with_transit_encryption_type_and_advanced_networkpolicies(
checks=[self.is_empty()],
)


@AllowLargeResponse()
@AKSCustomResourceGroupPreparer(
random_name_length=17,
name_prefix="clitest",
location="westcentralus",
)
def test_aks_create_with_acns_performance(

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Queued live test to validate the change.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if the live test passes, please find the recording file from pipeline artifact and commit it to your branch

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I checked in the recording file from my local run. Please let me know if that does not suffice.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Re-queued live test, test passed!

self, resource_group, resource_group_location
):
# reset the count so in replay mode the random names will start with 0
self.test_resources_count = 0
# kwargs for string formatting

aks_name = self.create_random_name("cliakstest", 16)
_, latest_version = self._get_versions(resource_group_location)
self.kwargs.update(
{
"resource_group": resource_group,
"name": aks_name,
"ssh_key_value": self.generate_ssh_keys(),
"location": resource_group_location,
"version": latest_version,
}
)
# Cilium Cluster with ACNS enabled and acceleration mode set to None
create_cmd = (
"aks create --resource-group={resource_group} --name={name} --location={location} -k {version} "
"--ssh-key-value={ssh_key_value} --node-count=1 --tier standard "
"--network-plugin azure --network-dataplane=cilium --network-plugin-mode overlay --enable-acns "
"--aks-custom-headers AKSHTTPCustomFeatures=Microsoft.ContainerService/AdvancedNetworkingPerformancePreview "
"--os-sku AzureLinux "
"--enable-acns --acns-datapath-acceleration-mode BpfVeth"
)
self.cmd(
create_cmd,
checks=[
self.check("provisioningState", "Succeeded"),
self.check("networkProfile.advancedNetworking.performance.accelerationMode", "BpfVeth"),
],
)

# Update acceleration mode to BpfVeth
update_cmd = (
"aks update --resource-group={resource_group} --name={name} "
"--aks-custom-headers AKSHTTPCustomFeatures=Microsoft.ContainerService/AdvancedNetworkingPerformancePreview "
"--enable-acns --acns-datapath-acceleration-mode BpfVeth"
)

self.cmd(
update_cmd,
checks=[
self.check("provisioningState", "Succeeded"),
self.check("networkProfile.advancedNetworking.enabled", True),
self.check("networkProfile.advancedNetworking.observability.enabled", True),
self.check("networkProfile.advancedNetworking.security.enabled", True),
self.check("networkProfile.advancedNetworking.security.advancedNetworkPolicies", "L7"),
self.check("networkProfile.advancedNetworking.security.transitEncryption.type", "WireGuard"),
],
)

# delete
self.cmd(
"aks delete -g {resource_group} -n {name} --yes --no-wait",
checks=[self.is_empty()],
)




@AllowLargeResponse()
@AKSCustomResourceGroupPreparer(
random_name_length=17,
Expand Down
Loading
Loading