Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions src/azure-cli/azure/cli/command_modules/acs/_help.py
Original file line number Diff line number Diff line change
Expand Up @@ -679,6 +679,9 @@
long-summary: |
Azure provides a different workload-runtime to enable Kata supported workloads in your nodepools. The following values can be specified:
- "KataVmIsolation" for Kata.
- name: --enable-upstream-kubescheduler-user-configuration
type: bool
short-summary: Enable user-defined scheduler configuration for kube-scheduler upstream on the cluster.

examples:
- name: Create a Kubernetes cluster with an existing SSH public key.
Expand Down Expand Up @@ -1235,6 +1238,12 @@
Auto: A standard set of Karpenter NodePools are provisioned.
None: No Karpenter NodePools are provisioned.
WARNING: Changing this from Auto to None on an existing cluster will cause the default Karpenter NodePools to be deleted, which will in turn drain and delete the nodes associated with those pools. It is strongly recommended to not do this unless there are idle nodes ready to take the pods evicted by that action.
- name: --enable-upstream-kubescheduler-user-configuration
type: bool
short-summary: Enable user-defined scheduler configuration for kube-scheduler upstream on the cluster.
- name: --disable-upstream-kubescheduler-user-configuration
type: bool
short-summary: Disable user-defined scheduler configuration for kube-scheduler upstream on the cluster.
examples:
- name: Reconcile the cluster back to its current state.
text: az aks update -g MyResourceGroup -n MyManagedCluster
Expand Down
4 changes: 4 additions & 0 deletions src/azure-cli/azure/cli/command_modules/acs/_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -678,6 +678,7 @@ def load_arguments(self, _):
action="store_true",
help="Enable managed installation of Gateway API CRDs from the standard release channel."
)
c.argument("enable_upstream_kubescheduler_user_configuration", action="store_true")

with self.argument_context('aks update') as c:
# managed cluster paramerters
Expand Down Expand Up @@ -945,6 +946,9 @@ def load_arguments(self, _):
action="store_true",
help="Disable managed installation of Gateway API CRDs."
)
c.argument("enable_upstream_kubescheduler_user_configuration", action="store_true")
c.argument("disable_upstream_kubescheduler_user_configuration", action="store_true")

with self.argument_context('aks delete') as c:
c.argument("if_match")
c.argument("if_none_match")
Expand Down
5 changes: 5 additions & 0 deletions src/azure-cli/azure/cli/command_modules/acs/custom.py
Original file line number Diff line number Diff line change
Expand Up @@ -1052,6 +1052,8 @@ def aks_create(
enable_app_routing_istio=False,
# gateway api
enable_gateway_api=False,
# user-defined scheduler configuration
enable_upstream_kubescheduler_user_configuration=False,
):
# DO NOT MOVE: get all the original parameters and save them as a dictionary
raw_parameters = locals()
Expand Down Expand Up @@ -1255,6 +1257,9 @@ def aks_update(
# gateway api
enable_gateway_api=False,
disable_gateway_api=False,
# user-defined scheduler configuration
enable_upstream_kubescheduler_user_configuration=False,
disable_upstream_kubescheduler_user_configuration=False,
):
# DO NOT MOVE: get all the original parameters and save them as a dictionary
raw_parameters = locals()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,9 @@ aks create:
enable_container_network_logs:
rule_exclusions:
- option_length_too_long
enable_upstream_kubescheduler_user_configuration:
rule_exclusions:
- option_length_too_long
aks enable-addons:
parameters:
appgw_watch_namespace:
Expand Down Expand Up @@ -254,6 +257,12 @@ aks update:
enable_http_proxy:
rule_exclusions:
- option_length_too_long
enable_upstream_kubescheduler_user_configuration:
rule_exclusions:
- option_length_too_long
disable_upstream_kubescheduler_user_configuration:
rule_exclusions:
- option_length_too_long
aks nodepool add:
parameters:
disable_windows_outbound_nat:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6371,6 +6371,31 @@ def get_disable_gateway_api(self) -> bool:
"""
return self.raw_param.get("disable_gateway_api", False)

def get_enable_upstream_kubescheduler_user_configuration(self) -> bool:
"""Obtain the value of enable_upstream_kubescheduler_user_configuration.

:return: bool
"""
return self.raw_param.get("enable_upstream_kubescheduler_user_configuration")

def get_disable_upstream_kubescheduler_user_configuration(self) -> bool:
"""Obtain the value of disable_upstream_kubescheduler_user_configuration.

:return: bool
"""
disable_upstream_kubescheduler_user_configuration = self.raw_param.get(
"disable_upstream_kubescheduler_user_configuration"
)
if (
disable_upstream_kubescheduler_user_configuration and
self.get_enable_upstream_kubescheduler_user_configuration()
):
raise MutuallyExclusiveArgumentError(
"Cannot specify --enable-upstream-kubescheduler-user-configuration and "
"--disable-upstream-kubescheduler-user-configuration at the same time."
)
return disable_upstream_kubescheduler_user_configuration
Comment on lines +6374 to +6397


class AKSManagedClusterCreateDecorator(BaseAKSManagedClusterDecorator):
def __init__(
Expand Down Expand Up @@ -8022,6 +8047,24 @@ def set_up_static_egress_gateway(self, mc: ManagedCluster) -> ManagedCluster:
# Default is disabled so no need to worry about that here
return mc

def set_up_upstream_kubescheduler_user_configuration(self, mc: ManagedCluster) -> ManagedCluster:
"""Set up user-defined scheduler configuration for kube-scheduler upstream for the ManagedCluster object.

:return: the ManagedCluster object
"""
self._ensure_mc(mc)

if self.context.get_enable_upstream_kubescheduler_user_configuration():
if mc.scheduler_profile is None:
mc.scheduler_profile = self.models.SchedulerProfile() # pylint: disable=no-member
if mc.scheduler_profile.upstream is None:
mc.scheduler_profile.upstream = self.models.SchedulerInstanceProfile() # pylint: disable=no-member
mc.scheduler_profile.upstream.scheduler_config_mode = (
self.models.SchedulerConfigMode.MANAGED_BY_CRD # pylint: disable=no-member
)

return mc

def construct_mc_profile_default(self, bypass_restore_defaults: bool = False) -> ManagedCluster:
"""The overall controller used to construct the default ManagedCluster profile.

Expand Down Expand Up @@ -8119,6 +8162,8 @@ def construct_mc_profile_default(self, bypass_restore_defaults: bool = False) ->
mc = self.set_up_static_egress_gateway(mc)
# set up node provisioning profile
mc = self.set_up_node_provisioning_profile(mc)
# set up user-defined scheduler configuration for kube-scheduler upstream
mc = self.set_up_upstream_kubescheduler_user_configuration(mc)

# DO NOT MOVE: keep this at the bottom, restore defaults
if not bypass_restore_defaults:
Expand Down Expand Up @@ -10548,6 +10593,32 @@ def update_node_provisioning_profile(self, mc: ManagedCluster) -> ManagedCluster

return mc

def update_upstream_kubescheduler_user_configuration(self, mc: ManagedCluster) -> ManagedCluster:
"""Update user-defined scheduler configuration for kube-scheduler upstream for the ManagedCluster object.

:return: the ManagedCluster object
"""
self._ensure_mc(mc)

# this getter also validates that the enable and disable options are mutually exclusive
disable_user_configuration = self.context.get_disable_upstream_kubescheduler_user_configuration()
enable_user_configuration = self.context.get_enable_upstream_kubescheduler_user_configuration()

scheduler_config_mode = None
if enable_user_configuration:
scheduler_config_mode = self.models.SchedulerConfigMode.MANAGED_BY_CRD # pylint: disable=no-member
elif disable_user_configuration:
scheduler_config_mode = self.models.SchedulerConfigMode.DEFAULT # pylint: disable=no-member

if scheduler_config_mode is not None:
if mc.scheduler_profile is None:
mc.scheduler_profile = self.models.SchedulerProfile() # pylint: disable=no-member
if mc.scheduler_profile.upstream is None:
mc.scheduler_profile.upstream = self.models.SchedulerInstanceProfile() # pylint: disable=no-member
mc.scheduler_profile.upstream.scheduler_config_mode = scheduler_config_mode

return mc

def update_mc_profile_default(self) -> ManagedCluster:
"""The overall controller used to update the default ManagedCluster profile.

Expand Down Expand Up @@ -10651,6 +10722,8 @@ def update_mc_profile_default(self) -> ManagedCluster:
mc = self.update_vmas_to_vms(mc)
# update node provisioning profile
mc = self.update_node_provisioning_profile(mc)
# update user-defined scheduler configuration for kube-scheduler upstream
mc = self.update_upstream_kubescheduler_user_configuration(mc)
return mc

def update_kubernetes_version_and_orchestrator_version(self, mc: ManagedCluster) -> ManagedCluster:
Expand Down
Loading
Loading