@@ -2944,6 +2944,31 @@ def get_enable_http_proxy(self) -> bool:
29442944
29452945 return enable_http_proxy
29462946
2947+ def get_enable_upstream_kubescheduler_user_configuration (self ) -> bool :
2948+ """Obtain the value of enable_upstream_kubescheduler_user_configuration.
2949+
2950+ :return: bool
2951+ """
2952+ return self .raw_param .get ("enable_upstream_kubescheduler_user_configuration" )
2953+
2954+ def get_disable_upstream_kubescheduler_user_configuration (self ) -> bool :
2955+ """Obtain the value of disable_upstream_kubescheduler_user_configuration.
2956+
2957+ :return: bool
2958+ """
2959+ disable_upstream_kubescheduler_user_configuration = self .raw_param .get (
2960+ "disable_upstream_kubescheduler_user_configuration"
2961+ )
2962+ if (
2963+ disable_upstream_kubescheduler_user_configuration and
2964+ self .get_enable_upstream_kubescheduler_user_configuration ()
2965+ ):
2966+ raise MutuallyExclusiveArgumentError (
2967+ "Cannot specify --enable-upstream-kubescheduler-user-configuration and "
2968+ "--disable-upstream-kubescheduler-user-configuration at the same time."
2969+ )
2970+ return disable_upstream_kubescheduler_user_configuration
2971+
29472972
29482973# pylint: disable=too-many-public-methods
29492974class AKSPreviewManagedClusterCreateDecorator (AKSManagedClusterCreateDecorator ):
@@ -3721,6 +3746,22 @@ def set_up_imds_restriction(self, mc: ManagedCluster) -> ManagedCluster:
37213746 mc .network_profile .pod_link_local_access = CONST_IMDS_RESTRICTION_ENABLED
37223747 return mc
37233748
3749+ def set_up_upstream_kubescheduler_user_configuration (self , mc : ManagedCluster ) -> ManagedCluster :
3750+ self ._ensure_mc (mc )
3751+
3752+ if self .context .get_enable_upstream_kubescheduler_user_configuration ():
3753+ if mc .scheduler_profile is None :
3754+ mc .scheduler_profile = self .models .SchedulerProfile () # pylint: disable=no-member
3755+ if mc .scheduler_profile .scheduler_instance_profiles is None :
3756+ mc .scheduler_profile .scheduler_instance_profiles = (
3757+ self .models .SchedulerProfileSchedulerInstanceProfiles () # pylint: disable=no-member
3758+ )
3759+ if mc .scheduler_profile .scheduler_instance_profiles .upstream is None :
3760+ mc .scheduler_profile .scheduler_instance_profiles .upstream = self .models .SchedulerInstanceProfile () # pylint: disable=no-member
3761+ mc .scheduler_profile .scheduler_instance_profiles .upstream .scheduler_config_mode = 'ManagedByCRD'
3762+
3763+ return mc
3764+
37243765 # pylint: disable=unused-argument
37253766 def construct_mc_profile_preview (self , bypass_restore_defaults : bool = False ) -> ManagedCluster :
37263767 """The overall controller used to construct the default ManagedCluster profile.
@@ -3781,6 +3822,8 @@ def construct_mc_profile_preview(self, bypass_restore_defaults: bool = False) ->
37813822 mc = self .set_up_static_egress_gateway (mc )
37823823 # set up imds restriction(a property in network profile)
37833824 mc = self .set_up_imds_restriction (mc )
3825+ # set up user-defined scheduler configuration for kube-scheduler upstream
3826+ mc = self .set_up_upstream_kubescheduler_user_configuration (mc )
37843827
37853828 # validate the azure cli core version
37863829 self .verify_cli_core_version ()
@@ -5539,6 +5582,37 @@ def update_http_proxy_enabled(self, mc: ManagedCluster) -> ManagedCluster:
55395582
55405583 return mc
55415584
5585+ def update_upstream_kubescheduler_user_configuration (self , mc : ManagedCluster ) -> ManagedCluster :
5586+ """Update user-defined scheduler configuration for kube-scheduler upstream for the ManagedCluster object.
5587+
5588+ :return: the ManagedCluster object
5589+ """
5590+ self ._ensure_mc (mc )
5591+
5592+ if self .context .get_enable_upstream_kubescheduler_user_configuration ():
5593+ if mc .scheduler_profile is None :
5594+ mc .scheduler_profile = self .models .SchedulerProfile () # pylint: disable=no-member
5595+ if mc .scheduler_profile .scheduler_instance_profiles is None :
5596+ mc .scheduler_profile .scheduler_instance_profiles = (
5597+ self .models .SchedulerProfileSchedulerInstanceProfiles () # pylint: disable=no-member
5598+ )
5599+ if mc .scheduler_profile .scheduler_instance_profiles .upstream is None :
5600+ mc .scheduler_profile .scheduler_instance_profiles .upstream = self .models .SchedulerInstanceProfile () # pylint: disable=no-member
5601+ mc .scheduler_profile .scheduler_instance_profiles .upstream .scheduler_config_mode = 'ManagedByCRD'
5602+
5603+ if self .context .get_disable_upstream_kubescheduler_user_configuration ():
5604+ if mc .scheduler_profile is None :
5605+ mc .scheduler_profile = self .models .SchedulerProfile () # pylint: disable=no-member
5606+ if mc .scheduler_profile .scheduler_instance_profiles is None :
5607+ mc .scheduler_profile .scheduler_instance_profiles = (
5608+ self .models .SchedulerProfileSchedulerInstanceProfiles () # pylint: disable=no-member
5609+ )
5610+ if mc .scheduler_profile .scheduler_instance_profiles .upstream is None :
5611+ mc .scheduler_profile .scheduler_instance_profiles .upstream = self .models .SchedulerInstanceProfile () # pylint: disable=no-member
5612+ mc .scheduler_profile .scheduler_instance_profiles .upstream .scheduler_config_mode = 'Default'
5613+
5614+ return mc
5615+
55425616 def update_mc_profile_preview (self ) -> ManagedCluster :
55435617 """The overall controller used to update the preview ManagedCluster profile.
55445618
@@ -5616,6 +5690,8 @@ def update_mc_profile_preview(self) -> ManagedCluster:
56165690 mc = self .update_vmas_to_vms (mc )
56175691 # update http proxy config
56185692 mc = self .update_http_proxy_enabled (mc )
5693+ # update user-defined scheduler configuration for kube-scheduler upstream
5694+ mc = self .update_upstream_kubescheduler_user_configuration (mc )
56195695 # update ManagedSystem pools, must at end
56205696 mc = self .update_managed_system_pools (mc )
56215697
0 commit comments