|
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 |
|
@@ -3817,6 +3831,29 @@ def update_load_balancer_profile(self, mc: ManagedCluster) -> ManagedCluster:
|
3817 | 3831 | )
|
3818 | 3832 | return mc
|
3819 | 3833 |
|
| 3834 | + def update_nat_gateway_profile(self, mc: ManagedCluster) -> ManagedCluster: |
| 3835 | + """Update nat gateway profile for the ManagedCluster object. |
| 3836 | +
|
| 3837 | + :return: the ManagedCluster object |
| 3838 | + """ |
| 3839 | + self._ensure_mc(mc) |
| 3840 | + |
| 3841 | + if not mc.network_profile: |
| 3842 | + raise UnknownError( |
| 3843 | + "Unexpectedly get an empty network profile in the process of updating nat gateway profile." |
| 3844 | + ) |
| 3845 | + outbound_type = self.context.get_outbound_type() |
| 3846 | + if outbound_type and outbound_type != CONST_OUTBOUND_TYPE_MANAGED_NAT_GATEWAY: |
| 3847 | + mc.network_profile.nat_gateway_profile = None |
| 3848 | + else: |
| 3849 | + mc.network_profile.nat_gateway_profile = _update_nat_gateway_profile( |
| 3850 | + self.context.get_nat_gateway_managed_outbound_ip_count(), |
| 3851 | + self.context.get_nat_gateway_idle_timeout(), |
| 3852 | + mc.network_profile.nat_gateway_profile, |
| 3853 | + models=self.models.nat_gateway_models, |
| 3854 | + ) |
| 3855 | + return mc |
| 3856 | + |
3820 | 3857 | def update_outbound_type_in_network_profile(self, mc: ManagedCluster) -> ManagedCluster:
|
3821 | 3858 | """Update outbound type of network profile for the ManagedCluster object.
|
3822 | 3859 | :return: the ManagedCluster object
|
@@ -4657,6 +4694,8 @@ def update_mc_profile_preview(self) -> ManagedCluster:
|
4657 | 4694 | mc = self.update_outbound_type_in_network_profile(mc)
|
4658 | 4695 | # update loadbalancer profile
|
4659 | 4696 | mc = self.update_load_balancer_profile(mc)
|
| 4697 | + # update natgateway profile |
| 4698 | + mc = self.update_nat_gateway_profile(mc) |
4660 | 4699 | # update kube proxy config
|
4661 | 4700 | mc = self.update_kube_proxy_config(mc)
|
4662 | 4701 | # update custom ca trust certificates
|
|
0 commit comments