Skip to content

Commit 330ce49

Browse files
committed
Merge remote-tracking branch 'upstream/main' into nguyensteven/pfl-preview
2 parents a0e3981 + 84dbe1f commit 330ce49

Some content is hidden

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

58 files changed

+13571
-280
lines changed

.github/copilot-instructions.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
- @azure Rule - Use Azure Best Practices: When generating code for Azure, running terminal commands for Azure, or performing operations related to Azure, invoke your `azure_development-get_best_practices` tool if available.

src/aks-preview/HISTORY.rst

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,14 @@ To release a new version, please select a new version number (usually plus 1 to
1212
Pending
1313
+++++++
1414

15-
14.0.0b6
15+
14.0.0b7
1616
++++++++
1717
* Add `az aks create/update --enable-retina-flow-logs` and `az aks update --disable-retina-flow-logs` commands.
1818

19+
14.0.0b6
20+
+++++++
21+
* Add option `--acns-advanced-networkpolicies <None|FQDN|L7>` to `az aks create/update`
22+
1923
14.0.0b5
2024
++++++++
2125
* Re-generate the SDK for API version 2025-02-02-preview with @autorest/python@6.32.3 to fix `\#31345 <https://github.com/Azure/azure-cli/issues/31345>`_.

src/aks-preview/azext_aks_preview/_consts.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,11 @@
125125
CONST_NETWORK_POLICY_CILIUM = "cilium"
126126
CONST_NETWORK_POLICY_NONE = "none"
127127

128+
# ACNS advanced network policies
129+
CONST_ADVANCED_NETWORKPOLICIES_NONE = "None"
130+
CONST_ADVANCED_NETWORKPOLICIES_FQDN = "FQDN"
131+
CONST_ADVANCED_NETWORKPOLICIES_L7 = "L7"
132+
128133
# network pod ip allocation mode
129134
CONST_NETWORK_POD_IP_ALLOCATION_MODE_DYNAMIC_INDIVIDUAL = "DynamicIndividual"
130135
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
@@ -228,6 +228,9 @@
228228
- name: --disable-acns-security
229229
type: bool
230230
short-summary: Used to disable advanced networking security features on a clusters when enabling advanced networking features with "--enable-acns".
231+
- name: --acns-advanced-networkpolicies
232+
type: string
233+
short-summary: Used to enable advanced network policies (None, FQDN or L7) on a cluster when enabling advanced networking features with "--enable-acns".
231234
- name: --enable-retina-flow-logs
232235
type: bool
233236
short-summary: Enable advanced network flow log collection functionalities on a cluster.
@@ -1217,6 +1220,9 @@
12171220
- name: --disable-acns-security
12181221
type: bool
12191222
short-summary: Used to disable advanced networking security features on a clusters when enabling advanced networking features with "--enable-acns".
1223+
- name: --acns-advanced-networkpolicies
1224+
type: string
1225+
short-summary: Used to enable advanced network policies (None, FQDN or L7) on a cluster when enabling advanced networking features with "--enable-acns".
12201226
- name: --enable-retina-flow-logs
12211227
type: bool
12221228
short-summary: Enable advanced network flow log collection functionalities on a cluster.

src/aks-preview/azext_aks_preview/_params.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,9 @@
130130
CONST_APP_ROUTING_NONE_NGINX,
131131
CONST_GPU_DRIVER_TYPE_CUDA,
132132
CONST_GPU_DRIVER_TYPE_GRID,
133+
CONST_ADVANCED_NETWORKPOLICIES_NONE,
134+
CONST_ADVANCED_NETWORKPOLICIES_FQDN,
135+
CONST_ADVANCED_NETWORKPOLICIES_L7,
133136
)
134137
from azext_aks_preview._validators import (
135138
validate_acr,
@@ -277,6 +280,11 @@
277280
CONST_NETWORK_PLUGIN_NONE,
278281
]
279282
network_plugin_modes = [CONST_NETWORK_PLUGIN_MODE_OVERLAY]
283+
advanced_networkpolicies = [
284+
CONST_ADVANCED_NETWORKPOLICIES_NONE,
285+
CONST_ADVANCED_NETWORKPOLICIES_FQDN,
286+
CONST_ADVANCED_NETWORKPOLICIES_L7,
287+
]
280288
network_dataplanes = [CONST_NETWORK_DATAPLANE_AZURE, CONST_NETWORK_DATAPLANE_CILIUM]
281289
disk_driver_versions = [CONST_DISK_DRIVER_V1, CONST_DISK_DRIVER_V2]
282290
outbound_types = [
@@ -825,6 +833,11 @@ def load_arguments(self, _):
825833
"disable_acns_security",
826834
action="store_true",
827835
)
836+
c.argument(
837+
"acns_advanced_networkpolicies",
838+
is_preview=True,
839+
arg_type=get_enum_type(advanced_networkpolicies),
840+
)
828841
c.argument(
829842
"enable_retina_flow_logs",
830843
action="store_true",
@@ -1307,6 +1320,11 @@ def load_arguments(self, _):
13071320
"disable_acns_security",
13081321
action="store_true",
13091322
)
1323+
c.argument(
1324+
"acns_advanced_networkpolicies",
1325+
is_preview=True,
1326+
arg_type=get_enum_type(advanced_networkpolicies),
1327+
)
13101328
c.argument(
13111329
"enable_retina_flow_logs",
13121330
action="store_true",

src/aks-preview/azext_aks_preview/custom.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -493,6 +493,7 @@ def aks_create(
493493
enable_acns=None,
494494
disable_acns_observability=None,
495495
disable_acns_security=None,
496+
acns_advanced_networkpolicies=None,
496497
enable_retina_flow_logs=None,
497498
# nodepool
498499
crg_id=None,
@@ -725,6 +726,7 @@ def aks_update(
725726
disable_acns=None,
726727
disable_acns_observability=None,
727728
disable_acns_security=None,
729+
acns_advanced_networkpolicies=None,
728730
enable_retina_flow_logs=None,
729731
disable_retina_flow_logs=None,
730732
# metrics profile

src/aks-preview/azext_aks_preview/managed_cluster_decorator.py

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -763,6 +763,21 @@ def get_acns_security(self) -> Union[bool, None]:
763763
return not disable_acns_security
764764
return None
765765

766+
def get_acns_advanced_networkpolicies(self) -> Union[str, None]:
767+
"""Get the value of acns_advanced_networkpolicies
768+
769+
:return: str or None
770+
"""
771+
disable_acns_security = self.raw_param.get("disable_acns_security")
772+
disable_acns = self.raw_param.get("disable_acns")
773+
acns_advanced_networkpolicies = self.raw_param.get("acns_advanced_networkpolicies")
774+
if acns_advanced_networkpolicies is not None:
775+
if disable_acns_security or disable_acns:
776+
raise MutuallyExclusiveArgumentError(
777+
"--disable-acns-security and --disable-acns cannot be used with acns_advanced_networkpolicies."
778+
)
779+
return self.raw_param.get("acns_advanced_networkpolicies")
780+
766781
def get_retina_flow_logs(self, mc: ManagedCluster) -> Union[bool, None]:
767782
"""Get the enablement of retina flow logs
768783
@@ -2968,6 +2983,7 @@ def set_up_network_profile(self, mc: ManagedCluster) -> ManagedCluster:
29682983

29692984
acns = None
29702985
(acns_enabled, acns_observability_enabled, acns_security_enabled) = self.context.get_acns_enablement()
2986+
acns_advanced_networkpolicies = self.context.get_acns_advanced_networkpolicies()
29712987
if acns_enabled is not None:
29722988
acns = self.models.AdvancedNetworking(
29732989
enabled=acns_enabled,
@@ -2980,8 +2996,14 @@ def set_up_network_profile(self, mc: ManagedCluster) -> ManagedCluster:
29802996
acns.security = self.models.AdvancedNetworkingSecurity(
29812997
enabled=acns_security_enabled,
29822998
)
2999+
if acns_advanced_networkpolicies is not None:
3000+
if acns.security is None:
3001+
acns.security = self.models.AdvancedNetworkingSecurity(
3002+
advanced_network_policies=acns_advanced_networkpolicies
3003+
)
3004+
else:
3005+
acns.security.advanced_network_policies = acns_advanced_networkpolicies
29833006
network_profile.advanced_networking = acns
2984-
29853007
return mc
29863008

29873009
def set_up_api_server_access_profile(self, mc: ManagedCluster) -> ManagedCluster:
@@ -4063,6 +4085,7 @@ def update_acns_in_network_profile(self, mc: ManagedCluster) -> ManagedCluster:
40634085

40644086
acns = None
40654087
(acns_enabled, acns_observability_enabled, acns_security_enabled) = self.context.get_acns_enablement()
4088+
acns_advanced_networkpolicies = self.context.get_acns_advanced_networkpolicies()
40664089
if acns_enabled is not None:
40674090
acns = self.models.AdvancedNetworking(
40684091
enabled=acns_enabled,
@@ -4075,6 +4098,13 @@ def update_acns_in_network_profile(self, mc: ManagedCluster) -> ManagedCluster:
40754098
acns.security = self.models.AdvancedNetworkingSecurity(
40764099
enabled=acns_security_enabled,
40774100
)
4101+
if acns_advanced_networkpolicies is not None:
4102+
if acns.security is None:
4103+
acns.security = self.models.AdvancedNetworkingSecurity(
4104+
advanced_network_policies=acns_advanced_networkpolicies
4105+
)
4106+
else:
4107+
acns.security.advanced_network_policies = acns_advanced_networkpolicies
40784108
mc.network_profile.advanced_networking = acns
40794109
return mc
40804110

0 commit comments

Comments
 (0)