|
43 | 43 | from azext_aks_preview._loadbalancer import (
|
44 | 44 | update_load_balancer_profile as _update_load_balancer_profile,
|
45 | 45 | )
|
| 46 | +from azext_aks_preview._natgateway import create_nat_gateway_profile |
| 47 | +from azext_aks_preview._natgateway import ( |
| 48 | + update_nat_gateway_profile as _update_nat_gateway_profile |
| 49 | +) |
46 | 50 | from azext_aks_preview._podidentity import (
|
47 | 51 | _fill_defaults_for_pod_identity_profile,
|
48 | 52 | _is_pod_identity_addon_enabled,
|
@@ -2739,6 +2743,13 @@ def set_up_network_profile(self, mc: ManagedCluster) -> ManagedCluster:
|
2739 | 2743 | models=self.models.load_balancer_models,
|
2740 | 2744 | )
|
2741 | 2745 |
|
| 2746 | + if self.context.get_nat_gateway_managed_outbound_ip_count() is not None: |
| 2747 | + network_profile.nat_gateway_profile = create_nat_gateway_profile( |
| 2748 | + self.context.get_nat_gateway_managed_outbound_ip_count(), |
| 2749 | + self.context.get_nat_gateway_idle_timeout(), |
| 2750 | + models=self.models.nat_gateway_models, |
| 2751 | + ) |
| 2752 | + |
2742 | 2753 | network_profile.network_plugin_mode = self.context.get_network_plugin_mode()
|
2743 | 2754 |
|
2744 | 2755 | if self.context.get_enable_cilium_dataplane():
|
@@ -3574,6 +3585,10 @@ def get_special_parameter_default_value_pairs_list(self) -> List[Tuple[Any, Any]
|
3574 | 3585 | (self.context.get_nodepool_labels(), None),
|
3575 | 3586 | (self.context.get_nodepool_taints(), None),
|
3576 | 3587 | (self.context.raw_param.get("upgrade_settings"), None),
|
| 3588 | + (self.context.get_load_balancer_managed_outbound_ip_count(), None), |
| 3589 | + (self.context.get_load_balancer_managed_outbound_ipv6_count(), None), |
| 3590 | + (self.context.get_load_balancer_outbound_ports(), None), |
| 3591 | + (self.context.get_nat_gateway_managed_outbound_ip_count(), None), |
3577 | 3592 | ]
|
3578 | 3593 |
|
3579 | 3594 | def check_raw_parameters(self):
|
@@ -3601,7 +3616,6 @@ def check_raw_parameters(self):
|
3601 | 3616 | if pair[0] != pair[1]:
|
3602 | 3617 | is_different_from_special_default = True
|
3603 | 3618 | break
|
3604 |
| - |
3605 | 3619 | if is_changed or is_different_from_special_default:
|
3606 | 3620 | return
|
3607 | 3621 |
|
@@ -3902,6 +3916,29 @@ def update_load_balancer_profile(self, mc: ManagedCluster) -> ManagedCluster:
|
3902 | 3916 | )
|
3903 | 3917 | return mc
|
3904 | 3918 |
|
| 3919 | + def update_nat_gateway_profile(self, mc: ManagedCluster) -> ManagedCluster: |
| 3920 | + """Update nat gateway profile for the ManagedCluster object. |
| 3921 | +
|
| 3922 | + :return: the ManagedCluster object |
| 3923 | + """ |
| 3924 | + self._ensure_mc(mc) |
| 3925 | + |
| 3926 | + if not mc.network_profile: |
| 3927 | + raise UnknownError( |
| 3928 | + "Unexpectedly get an empty network profile in the process of updating nat gateway profile." |
| 3929 | + ) |
| 3930 | + outbound_type = self.context.get_outbound_type() |
| 3931 | + if outbound_type and outbound_type != CONST_OUTBOUND_TYPE_MANAGED_NAT_GATEWAY: |
| 3932 | + mc.network_profile.nat_gateway_profile = None |
| 3933 | + else: |
| 3934 | + mc.network_profile.nat_gateway_profile = _update_nat_gateway_profile( |
| 3935 | + self.context.get_nat_gateway_managed_outbound_ip_count(), |
| 3936 | + self.context.get_nat_gateway_idle_timeout(), |
| 3937 | + mc.network_profile.nat_gateway_profile, |
| 3938 | + models=self.models.nat_gateway_models, |
| 3939 | + ) |
| 3940 | + return mc |
| 3941 | + |
3905 | 3942 | def update_outbound_type_in_network_profile(self, mc: ManagedCluster) -> ManagedCluster:
|
3906 | 3943 | """Update outbound type of network profile for the ManagedCluster object.
|
3907 | 3944 | :return: the ManagedCluster object
|
@@ -4742,6 +4779,8 @@ def update_mc_profile_preview(self) -> ManagedCluster:
|
4742 | 4779 | mc = self.update_outbound_type_in_network_profile(mc)
|
4743 | 4780 | # update loadbalancer profile
|
4744 | 4781 | mc = self.update_load_balancer_profile(mc)
|
| 4782 | + # update natgateway profile |
| 4783 | + mc = self.update_nat_gateway_profile(mc) |
4745 | 4784 | # update kube proxy config
|
4746 | 4785 | mc = self.update_kube_proxy_config(mc)
|
4747 | 4786 | # update custom ca trust certificates
|
|
0 commit comments