[AKS] implement enable/disable flags for user-defined scheduler configuration - #33934
Conversation
Signed-off-by: Pedro Tôrres <pedrotorres@microsoft.com>
|
Hi Pedro Tôrres (@t0rr3sp3dr0), |
|
Azure Pipelines: There may be pipelines that require an authorized user to comment /azp run to run. |
There was a problem hiding this comment.
Pull request overview
Adds new az aks create / az aks update flags to enable/disable AKS “User-Defined Scheduler Configuration” for upstream kube-scheduler by setting schedulerProfile.upstream.schedulerConfigMode to ManagedByCRD or Default, and includes unit + scenario test coverage plus updated help text.
Changes:
- Introduces
--enable-upstream-kubescheduler-user-configurationforaks createandaks update, and--disable-upstream-kubescheduler-user-configurationforaks update. - Implements decorator logic to set
schedulerProfile.upstream.schedulerConfigModeaccordingly (including mutual exclusivity validation for update). - Adds unit tests and scenario tests (with recordings) verifying the created/updated cluster’s
schedulerProfilestate.
Reviewed changes
Copilot reviewed 7 out of 10 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| src/azure-cli/azure/cli/command_modules/acs/managed_cluster_decorator.py | Adds context getters + create/update decorator logic to set schedulerConfigMode. |
| src/azure-cli/azure/cli/command_modules/acs/custom.py | Extends aks_create / aks_update signatures to accept the new flags. |
| src/azure-cli/azure/cli/command_modules/acs/_params.py | Registers the new CLI arguments for aks create and aks update. |
| src/azure-cli/azure/cli/command_modules/acs/_help.py | Documents the new flags in command help. |
| src/azure-cli/azure/cli/command_modules/acs/linter_exclusions.yml | Excludes option-length lint for the new long parameter names. |
| src/azure-cli/azure/cli/command_modules/acs/tests/latest/test_managed_cluster_decorator.py | Adds unit tests for the create/update decorator behavior and mutual exclusivity. |
| src/azure-cli/azure/cli/command_modules/acs/tests/latest/test_aks_commands.py | Adds scenario tests for create/update enable/disable flows. |
| src/azure-cli/azure/cli/command_modules/acs/tests/latest/recordings/test_aks_update_with_disable_upstream_kubescheduler_user_configuration.yaml | Adds playback recording for the disable scenario test. |
Suppressed comments (1)
src/azure-cli/azure/cli/command_modules/acs/_params.py:950
- The new
aks updatearguments--enable-upstream-kubescheduler-user-configuration/--disable-upstream-kubescheduler-user-configurationare registered withouthelp=strings. That will likely leave these options undocumented inaz aks update -houtput. Please addhelp=text (matching the wording in_help.py) so users discover what the flags do from CLI help.
c.argument("enable_upstream_kubescheduler_user_configuration", action="store_true")
c.argument("disable_upstream_kubescheduler_user_configuration", action="store_true")
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| 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 |
| 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") |
|
/azp run |
|
Azure Pipelines: Successfully started running 3 pipeline(s). |
Live test results —
|
There was a problem hiding this comment.
Validation Summary
Current head commit (1c3357e):
CI (GitHub Actions): ✅ all 64 checks passed.
Live test (azdev test --live): ❌ failed (run)
CI is green, but the live test run against real Azure resources failed. please review the live-test run output and push a fix for the failing scenario(s). Re-request review once addressed.
|
🔔 Routing this PR to @Azure/act-observability-squad. |
| name_prefix="clitest", | ||
| location="eastus2euap", | ||
| ) | ||
| def test_aks_create_with_enable_upstream_kubescheduler_user_configuration( |
There was a problem hiding this comment.
Queued live test to validate the change, test passed!
🤖 PR Validation —⚠️ Review suggested
Related command
az aks create --subscription="${SUBSCRIPTION_ID}" --resource-group="${RESOURCEGROUP_NAME}" --location="${AZURE_LOCATION}" --name="${CLUSTER_NAME}" --kubernetes-version="${KUBERNETES_VERSION}" --enable-upstream-kubescheduler-user-configurationaz aks update --subscription="${SUBSCRIPTION_ID}" --resource-group="${RESOURCEGROUP_NAME}" --name="${CLUSTER_NAME}" --enable-upstream-kubescheduler-user-configurationaz aks update --subscription="${SUBSCRIPTION_ID}" --resource-group="${RESOURCEGROUP_NAME}" --name="${CLUSTER_NAME}" --disable-upstream-kubescheduler-user-configurationDescription
Introduce new Azure CLI flags for enabling/disabling User-Defined Scheduler Configuration for kube-scheduler Upstream in AKS Clusters.
Testing Guide
History Notes
az aks create: Add--enable-upstream-kubescheduler-user-configurationflag to enable User-Defined Scheduler Configuration for kube-scheduler Upstream on a new cluster.az aks update: Add--enable-upstream-kubescheduler-user-configurationflag to enable User-Defined Scheduler Configuration for kube-scheduler Upstream on an existing cluster.az aks update: Add--disable-upstream-kubescheduler-user-configurationflag to disable User-Defined Scheduler Configuration for kube-scheduler Upstream on an existing cluster.This checklist is used to make sure that common guidelines for a pull request are followed.
The PR title and description has followed the guideline in Submitting Pull Requests.
I adhere to the Command Guidelines.
I adhere to the Error Handling Guidelines.