|
41 | 41 | from azext_aks_preview._loadbalancer import (
|
42 | 42 | update_load_balancer_profile as _update_load_balancer_profile,
|
43 | 43 | )
|
| 44 | +from azext_aks_preview._natgateway import create_nat_gateway_profile |
| 45 | +from azext_aks_preview._natgateway import ( |
| 46 | + update_nat_gateway_profile as _update_nat_gateway_profile |
| 47 | +) |
44 | 48 | from azext_aks_preview._podidentity import (
|
45 | 49 | _fill_defaults_for_pod_identity_profile,
|
46 | 50 | _is_pod_identity_addon_enabled,
|
@@ -2691,6 +2695,13 @@ def set_up_network_profile(self, mc: ManagedCluster) -> ManagedCluster:
|
2691 | 2695 | models=self.models.load_balancer_models,
|
2692 | 2696 | )
|
2693 | 2697 |
|
| 2698 | + if self.context.get_nat_gateway_managed_outbound_ip_count() is not None: |
| 2699 | + network_profile.nat_gateway_profile = create_nat_gateway_profile( |
| 2700 | + self.context.get_nat_gateway_managed_outbound_ip_count(), |
| 2701 | + self.context.get_nat_gateway_idle_timeout(), |
| 2702 | + models=self.models.nat_gateway_models, |
| 2703 | + ) |
| 2704 | + |
2694 | 2705 | network_profile.network_plugin_mode = self.context.get_network_plugin_mode()
|
2695 | 2706 |
|
2696 | 2707 | if self.context.get_enable_cilium_dataplane():
|
@@ -3499,6 +3510,10 @@ def get_special_parameter_default_value_pairs_list(self) -> List[Tuple[Any, Any]
|
3499 | 3510 | (self.context.get_nodepool_labels(), None),
|
3500 | 3511 | (self.context.get_nodepool_taints(), None),
|
3501 | 3512 | (self.context.raw_param.get("upgrade_settings"), None),
|
| 3513 | + (self.context.get_load_balancer_managed_outbound_ip_count(), None), |
| 3514 | + (self.context.get_load_balancer_managed_outbound_ipv6_count(), None), |
| 3515 | + (self.context.get_load_balancer_outbound_ports(), None), |
| 3516 | + (self.context.get_nat_gateway_managed_outbound_ip_count(), None), |
3502 | 3517 | ]
|
3503 | 3518 |
|
3504 | 3519 | def check_raw_parameters(self):
|
@@ -3526,7 +3541,6 @@ def check_raw_parameters(self):
|
3526 | 3541 | if pair[0] != pair[1]:
|
3527 | 3542 | is_different_from_special_default = True
|
3528 | 3543 | break
|
3529 |
| - |
3530 | 3544 | if is_changed or is_different_from_special_default:
|
3531 | 3545 | return
|
3532 | 3546 |
|
@@ -3742,6 +3756,29 @@ def update_load_balancer_profile(self, mc: ManagedCluster) -> ManagedCluster:
|
3742 | 3756 | )
|
3743 | 3757 | return mc
|
3744 | 3758 |
|
| 3759 | + def update_nat_gateway_profile(self, mc: ManagedCluster) -> ManagedCluster: |
| 3760 | + """Update nat gateway profile for the ManagedCluster object. |
| 3761 | +
|
| 3762 | + :return: the ManagedCluster object |
| 3763 | + """ |
| 3764 | + self._ensure_mc(mc) |
| 3765 | + |
| 3766 | + if not mc.network_profile: |
| 3767 | + raise UnknownError( |
| 3768 | + "Unexpectedly get an empty network profile in the process of updating nat gateway profile." |
| 3769 | + ) |
| 3770 | + outbound_type = self.context.get_outbound_type() |
| 3771 | + if outbound_type and outbound_type != CONST_OUTBOUND_TYPE_MANAGED_NAT_GATEWAY: |
| 3772 | + mc.network_profile.nat_gateway_profile = None |
| 3773 | + else: |
| 3774 | + mc.network_profile.nat_gateway_profile = _update_nat_gateway_profile( |
| 3775 | + self.context.get_nat_gateway_managed_outbound_ip_count(), |
| 3776 | + self.context.get_nat_gateway_idle_timeout(), |
| 3777 | + mc.network_profile.nat_gateway_profile, |
| 3778 | + models=self.models.nat_gateway_models, |
| 3779 | + ) |
| 3780 | + return mc |
| 3781 | + |
3745 | 3782 | def update_outbound_type_in_network_profile(self, mc: ManagedCluster) -> ManagedCluster:
|
3746 | 3783 | """Update outbound type of network profile for the ManagedCluster object.
|
3747 | 3784 | :return: the ManagedCluster object
|
@@ -4538,6 +4575,8 @@ def update_mc_profile_preview(self) -> ManagedCluster:
|
4538 | 4575 | mc = self.update_outbound_type_in_network_profile(mc)
|
4539 | 4576 | # update loadbalancer profile
|
4540 | 4577 | mc = self.update_load_balancer_profile(mc)
|
| 4578 | + # update natgateway profile |
| 4579 | + mc = self.update_nat_gateway_profile(mc) |
4541 | 4580 | # update kube proxy config
|
4542 | 4581 | mc = self.update_kube_proxy_config(mc)
|
4543 | 4582 | # update custom ca trust certificates
|
|
0 commit comments