Skip to content

Commit b06cbbb

Browse files
Feature/aks acns performance (#9136)
* feat: add acns perf options * feat: fix issues, add tests * chore: update history * Update src/aks-preview/azext_aks_preview/managed_cluster_decorator.py Co-authored-by: Copilot <[email protected]> * Update src/aks-preview/azext_aks_preview/tests/latest/test_managed_cluster_decorator.py Co-authored-by: Copilot <[email protected]> * Update src/aks-preview/linter_exclusions.yml Co-authored-by: Copilot <[email protected]> * Update src/aks-preview/linter_exclusions.yml Co-authored-by: Copilot <[email protected]> * fix: address comments * fix: address comments * fix: switch to westcentralus * chore: update version * fix: undo accidental delete * chore: update acns perf test, add recording * fix bad merge --------- Co-authored-by: Copilot <[email protected]>
1 parent d169483 commit b06cbbb

File tree

11 files changed

+2076
-24
lines changed

11 files changed

+2076
-24
lines changed

src/aks-preview/HISTORY.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@ Pending
1616
- `az aks nodepool add/update/upgrade`: Add `--upgrade-strategy` parameter to switch between rolling and blue-green nodepool upgrades.
1717
- `az aks nodepool add/update/upgrade`: Add `--drain-batch-size`, `--drain-timeout-bg`, `--batch-soak-duration`, `--final-soak-duration` parameters to configure blue-green upgrade settings.
1818

19+
18.0.0b38
20+
+++++++
21+
* Add option `--acns-datapath-acceleration-mode <None|BpfVeth>` to `az aks create/update`
22+
1923
18.0.0b37
2024
+++++++
2125
* Enable autoscaler support for the VirtualMachines agent pool type.

src/aks-preview/azext_aks_preview/_consts.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,10 @@
150150
CONST_TRANSIT_ENCRYPTION_TYPE_NONE = "None"
151151
CONST_TRANSIT_ENCRYPTION_TYPE_WIREGUARD = "WireGuard"
152152

153+
# ACNS performance acceleration mode
154+
CONST_ACNS_DATAPATH_ACCELERATION_MODE_NONE = "None"
155+
CONST_ACNS_DATAPATH_ACCELERATION_MODE_BPFVETH = "BpfVeth"
156+
153157
# network pod ip allocation mode
154158
CONST_NETWORK_POD_IP_ALLOCATION_MODE_DYNAMIC_INDIVIDUAL = "DynamicIndividual"
155159
CONST_NETWORK_POD_IP_ALLOCATION_MODE_STATIC_BLOCK = "StaticBlock"

src/aks-preview/azext_aks_preview/_help.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -230,6 +230,9 @@
230230
- name: --acns-advanced-networkpolicies
231231
type: string
232232
short-summary: Used to enable advanced network policies (None, FQDN or L7) on a cluster when enabling advanced networking features with "--enable-acns".
233+
- name: --acns-datapath-acceleration-mode
234+
type: string
235+
short-summary: Used to set the acceleration mode (None or BpfVeth) on a cluster when enabling advanced networking features with "--enable-acns".
233236
- name: --enable-retina-flow-logs
234237
type: bool
235238
short-summary: Enable advanced network flow log collection functionalities on a cluster.
@@ -1244,6 +1247,9 @@
12441247
- name: --acns-advanced-networkpolicies
12451248
type: string
12461249
short-summary: Used to enable advanced network policies (None, FQDN or L7) on a cluster when enabling advanced networking features with "--enable-acns".
1250+
- name: --acns-datapath-acceleration-mode
1251+
type: string
1252+
short-summary: Used to set the acceleration mode (None or BpfVeth) on a cluster when enabling advanced networking features with "--enable-acns".
12471253
- name: --enable-retina-flow-logs
12481254
type: bool
12491255
short-summary: Enable advanced network flow log collection functionalities on a cluster.

src/aks-preview/azext_aks_preview/_params.py

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,8 +152,10 @@
152152
CONST_ADVANCED_NETWORKPOLICIES_L7,
153153
CONST_TRANSIT_ENCRYPTION_TYPE_NONE,
154154
CONST_TRANSIT_ENCRYPTION_TYPE_WIREGUARD,
155+
CONST_ACNS_DATAPATH_ACCELERATION_MODE_BPFVETH,
156+
CONST_ACNS_DATAPATH_ACCELERATION_MODE_NONE,
155157
CONST_UPGRADE_STRATEGY_ROLLING,
156-
CONST_UPGRADE_STRATEGY_BLUE_GREEN,
158+
CONST_UPGRADE_STRATEGY_BLUE_GREEN
157159
)
158160

159161
from azext_aks_preview._validators import (
@@ -342,6 +344,10 @@
342344
CONST_TRANSIT_ENCRYPTION_TYPE_NONE,
343345
CONST_TRANSIT_ENCRYPTION_TYPE_WIREGUARD,
344346
]
347+
acns_datapath_acceleration_modes = [
348+
CONST_ACNS_DATAPATH_ACCELERATION_MODE_NONE,
349+
CONST_ACNS_DATAPATH_ACCELERATION_MODE_BPFVETH,
350+
]
345351
network_dataplanes = [CONST_NETWORK_DATAPLANE_AZURE, CONST_NETWORK_DATAPLANE_CILIUM]
346352
disk_driver_versions = [CONST_DISK_DRIVER_V1, CONST_DISK_DRIVER_V2]
347353
outbound_types = [
@@ -922,6 +928,12 @@ def load_arguments(self, _):
922928
is_preview=True,
923929
arg_type=get_enum_type(advanced_networkpolicies),
924930
)
931+
c.argument(
932+
"acns_datapath_acceleration_mode",
933+
is_preview=True,
934+
arg_type=get_enum_type(acns_datapath_acceleration_modes),
935+
help="Specify the performance acceleration mode for ACNS. Available values are 'None' and 'BpfVeth'.",
936+
)
925937
c.argument(
926938
"acns_transit_encryption_type",
927939
is_preview=True,
@@ -1441,6 +1453,12 @@ def load_arguments(self, _):
14411453
is_preview=True,
14421454
arg_type=get_enum_type(advanced_networkpolicies),
14431455
)
1456+
c.argument(
1457+
"acns_datapath_acceleration_mode",
1458+
is_preview=True,
1459+
arg_type=get_enum_type(acns_datapath_acceleration_modes),
1460+
help="Specify the performance acceleration mode for ACNS. Available values are 'None' and 'BpfVeth'.",
1461+
)
14441462
c.argument(
14451463
"acns_transit_encryption_type",
14461464
is_preview=True,

src/aks-preview/azext_aks_preview/custom.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -700,6 +700,7 @@ def aks_create(
700700
acns_advanced_networkpolicies=None,
701701
acns_transit_encryption_type=None,
702702
enable_retina_flow_logs=None,
703+
acns_datapath_acceleration_mode=None,
703704
# nodepool
704705
crg_id=None,
705706
message_of_the_day=None,
@@ -942,6 +943,7 @@ def aks_update(
942943
acns_transit_encryption_type=None,
943944
enable_retina_flow_logs=None,
944945
disable_retina_flow_logs=None,
946+
acns_datapath_acceleration_mode=None,
945947
# metrics profile
946948
enable_cost_analysis=False,
947949
disable_cost_analysis=False,

src/aks-preview/azext_aks_preview/managed_cluster_decorator.py

Lines changed: 52 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,8 @@
4343
CONST_IMDS_RESTRICTION_DISABLED,
4444
CONST_AVAILABILITY_SET,
4545
CONST_VIRTUAL_MACHINES,
46+
CONST_ACNS_DATAPATH_ACCELERATION_MODE_BPFVETH,
47+
CONST_ACNS_DATAPATH_ACCELERATION_MODE_NONE
4648
)
4749
from azext_aks_preview._helpers import (
4850
check_is_apiserver_vnet_integration_cluster,
@@ -760,15 +762,27 @@ def get_enable_cilium_dataplane(self) -> bool:
760762
def get_acns_enablement(self) -> Tuple[
761763
Union[bool, None],
762764
Union[bool, None],
763-
Union[bool, None],
765+
Union[bool, None]
764766
]:
765-
"""Get the enablement of acns
767+
"""Get the enablement of acns (not including the performance suite)
766768
:return: Tuple of 3 elements which can be bool or None
767769
"""
770+
enable_acns, enable_acns_observability, enable_acns_security, _ = self.get_acns_enablement_with_perf()
771+
return enable_acns, enable_acns_observability, enable_acns_security
772+
773+
def get_acns_enablement_with_perf(self) -> Tuple[
774+
Union[bool, None],
775+
Union[bool, None],
776+
Union[bool, None],
777+
Union[bool, None]
778+
]:
779+
"""Get the enablement of acns including the performance suite
780+
:return: Tuple of 4 elements which can be bool or None
781+
"""
768782
enable_acns = self.raw_param.get("enable_acns")
769783
disable_acns = self.raw_param.get("disable_acns")
770784
if enable_acns is None and disable_acns is None:
771-
return None, None, None
785+
return None, None, None, None
772786
if enable_acns and disable_acns:
773787
raise MutuallyExclusiveArgumentError(
774788
"Cannot specify --enable-acns and "
@@ -778,17 +792,22 @@ def get_acns_enablement(self) -> Tuple[
778792
disable_acns = bool(disable_acns) if disable_acns is not None else False
779793
acns = enable_acns or not disable_acns
780794
acns_observability = self.get_acns_observability()
795+
acns_datapath_acceleration_mode = self.get_acns_datapath_acceleration_mode()
796+
acns_perf_enabled = None
797+
if acns_datapath_acceleration_mode is not None:
798+
acns_perf_enabled = acns_datapath_acceleration_mode == CONST_ACNS_DATAPATH_ACCELERATION_MODE_BPFVETH
781799
acns_security = self.get_acns_security()
782-
if acns and (acns_observability is False and acns_security is False):
800+
if acns and (acns_observability is False and acns_security is False and acns_perf_enabled is not True):
783801
raise MutuallyExclusiveArgumentError(
784-
"Cannot disable both observability and security when enabling ACNS. "
802+
"Cannot disable observability, security, and performance acceleration when enabling ACNS. "
785803
"Please enable at least one of them or disable ACNS with --disable-acns."
786804
)
787-
if not acns and (acns_observability is not None or acns_security is not None):
805+
if not acns and (acns_observability is not None or acns_security is not None
806+
or acns_datapath_acceleration_mode is not None):
788807
raise MutuallyExclusiveArgumentError(
789808
"--disable-acns does not use any additional acns arguments."
790809
)
791-
return acns, acns_observability, acns_security
810+
return acns, acns_observability, acns_security, acns_perf_enabled
792811

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

845+
def get_acns_datapath_acceleration_mode(self) -> Union[str, None]:
846+
"""Get the value of acns_datapath_acceleration_mode
847+
848+
:return: str or None
849+
"""
850+
disable_acns = self.raw_param.get("disable_acns")
851+
acns_datapath_acceleration_mode = self.raw_param.get("acns_datapath_acceleration_mode")
852+
if (acns_datapath_acceleration_mode is not None
853+
and acns_datapath_acceleration_mode != CONST_ACNS_DATAPATH_ACCELERATION_MODE_NONE):
854+
if disable_acns:
855+
raise MutuallyExclusiveArgumentError(
856+
"--disable-acns cannot be used with --acns-performance-acceleration-mode."
857+
)
858+
return acns_datapath_acceleration_mode
859+
826860
def get_acns_transit_encryption_type(self) -> Union[str, None]:
827861
"""Get the value of acns_transit_encryption_type
828862
@@ -3107,6 +3141,7 @@ def set_up_network_profile(self, mc: ManagedCluster) -> ManagedCluster:
31073141
(acns_enabled, acns_observability_enabled, acns_security_enabled) = self.context.get_acns_enablement()
31083142
acns_advanced_networkpolicies = self.context.get_acns_advanced_networkpolicies()
31093143
acns_transit_encryption_type = self.context.get_acns_transit_encryption_type()
3144+
acns_datapath_acceleration_mode = self.context.get_acns_datapath_acceleration_mode()
31103145
if acns_enabled is not None:
31113146
acns = self.models.AdvancedNetworking(
31123147
enabled=acns_enabled,
@@ -3132,6 +3167,11 @@ def set_up_network_profile(self, mc: ManagedCluster) -> ManagedCluster:
31323167
if acns.security.transit_encryption is None:
31333168
acns.security.transit_encryption = self.models.AdvancedNetworkingSecurityTransitEncryption()
31343169
acns.security.transit_encryption.type = acns_transit_encryption_type
3170+
if acns_datapath_acceleration_mode == CONST_ACNS_DATAPATH_ACCELERATION_MODE_BPFVETH:
3171+
if acns.performance is None:
3172+
acns.performance = self.models.AdvancedNetworkingPerformance()
3173+
acns.performance.acceleration_mode = acns_datapath_acceleration_mode
3174+
31353175
network_profile.advanced_networking = acns
31363176
return mc
31373177

@@ -4306,6 +4346,7 @@ def update_acns_in_network_profile(self, mc: ManagedCluster) -> ManagedCluster:
43064346
(acns_enabled, acns_observability_enabled, acns_security_enabled) = self.context.get_acns_enablement()
43074347
acns_advanced_networkpolicies = self.context.get_acns_advanced_networkpolicies()
43084348
acns_transit_encryption_type = self.context.get_acns_transit_encryption_type()
4349+
acns_datapath_acceleration_mode = self.context.get_acns_datapath_acceleration_mode()
43094350
if acns_enabled is not None:
43104351
acns = self.models.AdvancedNetworking(
43114352
enabled=acns_enabled,
@@ -4331,6 +4372,10 @@ def update_acns_in_network_profile(self, mc: ManagedCluster) -> ManagedCluster:
43314372
if acns.security.transit_encryption is None:
43324373
acns.security.transit_encryption = self.models.AdvancedNetworkingSecurityTransitEncryption()
43334374
acns.security.transit_encryption.type = acns_transit_encryption_type
4375+
if acns_datapath_acceleration_mode == CONST_ACNS_DATAPATH_ACCELERATION_MODE_BPFVETH:
4376+
if acns.performance is None:
4377+
acns.performance = self.models.AdvancedNetworkingPerformance()
4378+
acns.performance.acceleration_mode = acns_datapath_acceleration_mode
43344379
mc.network_profile.advanced_networking = acns
43354380
return mc
43364381

0 commit comments

Comments
 (0)