Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@
CONST_NETWORK_PLUGIN_AZURE,
CONST_NETWORK_PLUGIN_MODE_OVERLAY,
CONST_NETWORK_DATAPLANE_CILIUM,
CONST_NETWORK_POLICY_CILIUM,
CONST_PRIVATE_DNS_ZONE_NONE,
CONST_PRIVATE_DNS_ZONE_SYSTEM,
CONST_AZURE_KEYVAULT_SECRETS_PROVIDER_ADDON_NAME,
Expand Down Expand Up @@ -3436,6 +3437,11 @@ def update_network_plugin_settings(self, mc: ManagedCluster) -> ManagedCluster:
network_policy = self.context.get_network_policy()
if network_policy:
mc.network_profile.network_policy = network_policy
elif network_dataplane == CONST_NETWORK_DATAPLANE_CILIUM:
# force network_policy to "cilium" when network_dataplane is "cilium" to pass validation in aks rp
# this was needed because api version 2023-08-02preview introduced --network-policy=none
# without forcing network_policy to "cilium" here, when upgrading to cilium without specifying --network-policy, it will be set to none by default and validation in aks rp will fail.
mc.network_profile.network_policy = CONST_NETWORK_POLICY_CILIUM

return mc

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5104,6 +5104,7 @@ def test_update_network_plugin_settings(self):
network_plugin="azure",
network_plugin_mode="overlay",
network_dataplane="cilium",
network_policy="",
pod_cidr="100.64.0.0/16",
service_cidr="192.168.0.0/16"
),
Expand All @@ -5121,6 +5122,7 @@ def test_update_network_plugin_settings(self):
network_plugin="azure",
network_plugin_mode="overlay",
network_dataplane="cilium",
network_policy="cilium",
pod_cidr="100.64.0.0/16",
service_cidr="192.168.0.0/16",
),
Expand Down