|
49 | 49 | CONST_MANAGED_GATEWAY_INSTALLATION_STANDARD, |
50 | 50 | CONST_MANAGED_GATEWAY_INSTALLATION_DISABLED, |
51 | 51 | CONST_ACNS_DATAPATH_ACCELERATION_MODE_BPFVETH, |
52 | | - CONST_ACNS_DATAPATH_ACCELERATION_MODE_NONE |
| 52 | + CONST_ACNS_DATAPATH_ACCELERATION_MODE_NONE, |
| 53 | + CONST_TRANSIT_ENCRYPTION_TYPE_MTLS, |
| 54 | + CONST_ADVANCED_NETWORKPOLICIES_L7, |
53 | 55 | ) |
54 | 56 | from azext_aks_preview.azurecontainerstorage._consts import ( |
55 | 57 | CONST_ACSTOR_EXT_INSTALLATION_NAME, |
@@ -917,6 +919,49 @@ def get_acns_transit_encryption_type(self) -> Union[str, None]: |
917 | 919 | raise MutuallyExclusiveArgumentError( |
918 | 920 | "--disable-acns-security and --disable-acns cannot be used with --acns-transit-encryption-type." |
919 | 921 | ) |
| 922 | + if acns_transit_encryption_type == CONST_TRANSIT_ENCRYPTION_TYPE_MTLS: |
| 923 | + # Check CLI args for L7 |
| 924 | + acns_advanced_networkpolicies = self.raw_param.get("acns_advanced_networkpolicies") |
| 925 | + if acns_advanced_networkpolicies == CONST_ADVANCED_NETWORKPOLICIES_L7: |
| 926 | + raise MutuallyExclusiveArgumentError( |
| 927 | + "'--acns-transit-encryption-type mTLS' cannot be used with " |
| 928 | + "'--acns-advanced-networkpolicies L7'. " |
| 929 | + "Please choose either '--acns-advanced-networkpolicies L7' or " |
| 930 | + "'--acns-transit-encryption-type mTLS', but not both." |
| 931 | + ) |
| 932 | + # Check CLI args for Istio |
| 933 | + enable_asm = self.raw_param.get("enable_azure_service_mesh", False) |
| 934 | + if enable_asm: |
| 935 | + raise MutuallyExclusiveArgumentError( |
| 936 | + "'--acns-transit-encryption-type mTLS' cannot be used with " |
| 937 | + "'--enable-azure-service-mesh'. " |
| 938 | + "Please remove '--enable-azure-service-mesh' or choose a different " |
| 939 | + "transit encryption type." |
| 940 | + ) |
| 941 | + # On update, check existing cluster state |
| 942 | + if self.decorator_mode == DecoratorMode.UPDATE and self.mc: |
| 943 | + # Check if existing cluster has L7 enabled and user is not changing it |
| 944 | + if (acns_advanced_networkpolicies is None and |
| 945 | + self.mc.network_profile and |
| 946 | + self.mc.network_profile.advanced_networking and |
| 947 | + self.mc.network_profile.advanced_networking.security and |
| 948 | + self.mc.network_profile.advanced_networking.security.advanced_network_policies == |
| 949 | + CONST_ADVANCED_NETWORKPOLICIES_L7): |
| 950 | + raise MutuallyExclusiveArgumentError( |
| 951 | + "'--acns-transit-encryption-type mTLS' cannot be used with L7 advanced network policies. " |
| 952 | + "The existing cluster already has L7 enabled. Please disable L7 by passing " |
| 953 | + "'--acns-advanced-networkpolicies None' or choose a different transit encryption type." |
| 954 | + ) |
| 955 | + # Check if existing cluster has Istio enabled and user is not disabling it |
| 956 | + disable_asm = self.raw_param.get("disable_azure_service_mesh", False) |
| 957 | + if (not disable_asm and |
| 958 | + self.mc.service_mesh_profile and |
| 959 | + self.mc.service_mesh_profile.mode == CONST_AZURE_SERVICE_MESH_MODE_ISTIO): |
| 960 | + raise MutuallyExclusiveArgumentError( |
| 961 | + "'--acns-transit-encryption-type mTLS' cannot be used with Istio service mesh. " |
| 962 | + "The existing cluster already has Istio enabled. Please disable Istio by passing " |
| 963 | + "'--disable-azure-service-mesh' or choose a different transit encryption type." |
| 964 | + ) |
920 | 965 | return self.raw_param.get("acns_transit_encryption_type") |
921 | 966 |
|
922 | 967 | # Container network logs is the new name for retina flow logs. |
|
0 commit comments