-
Notifications
You must be signed in to change notification settings - Fork 3.4k
[AKS] az aks maintenanceconfiguration add/update: Add support for maintenanceWindow format in default maintenance configuration #33431
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: dev
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -59,10 +59,26 @@ def constructDefaultMaintenanceConfiguration(cmd, raw_parameters): | |
| start_hour = raw_parameters.get("start_hour") | ||
| schedule_type = raw_parameters.get("schedule_type") | ||
|
|
||
| if weekday is None or start_hour is None: | ||
| raise RequiredArgumentMissingError('Please specify --weekday and --start-hour for default maintenance configuration, or use --config-file instead.') | ||
| # If schedule_type is provided, use maintenanceWindow format for the default config | ||
| if schedule_type is not None: | ||
| raise MutuallyExclusiveArgumentError('--schedule-type is not supported for default maintenance configuration.') | ||
| if weekday is not None or start_hour is not None: | ||
| raise MutuallyExclusiveArgumentError('--weekday and --start-hour cannot be used together with --schedule-type for default maintenance configuration.') | ||
| if schedule_type != CONST_WEEKLY_MAINTENANCE_SCHEDULE: | ||
| raise InvalidArgumentValueError('--schedule-type for default maintenance configuration must be Weekly.') | ||
| interval_weeks = raw_parameters.get("interval_weeks") | ||
| if interval_weeks is not None and interval_weeks != 1: | ||
| raise InvalidArgumentValueError('--interval-weeks for default maintenance configuration must be 1.') | ||
| maintenance_configuration_models = AKSManagedClusterModels(cmd, ResourceType.MGMT_CONTAINERSERVICE).maintenance_configuration_models | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
The current check only rejects if interval_weeks is not None and interval_weeks != 1:
raise InvalidArgumentValueError('--interval-weeks for default maintenance configuration must be 1.')If a user runs That's a confusing error for the default-config flow where the value is forced to 1 anyway. Suggest one of:
The first option matches the RP contract better (only |
||
| Result = ( | ||
| maintenance_configuration_models.MaintenanceConfiguration | ||
| ) | ||
| result = Result() | ||
|
Comment on lines
+71
to
+75
|
||
| result.maintenance_window = constructMaintenanceWindow(cmd, raw_parameters) | ||
| return result | ||
|
Comment on lines
+62
to
+77
|
||
|
|
||
| # Legacy timeInWeek format | ||
| if weekday is None or start_hour is None: | ||
| raise RequiredArgumentMissingError('Please specify --weekday and --start-hour, or --schedule-type Weekly with --day-of-week, --start-time, and --duration for default maintenance configuration, or use --config-file instead.') | ||
|
|
||
| maintenance_configuration_models = AKSManagedClusterModels(cmd, ResourceType.MGMT_CONTAINERSERVICE).maintenance_configuration_models | ||
| TimeInWeek = ( | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Help text for
--schedule-typeis now inconsistent with--start-hour/--weekdayhelp.This line now says
--schedule-typeis supported for default config (Weekly only), but the help for--weekdayand--start-hour(a few lines above, e.g. line 1626) still saysApplicable to default maintenance configuration only.without mentioning that the maintenanceWindow path is now the preferred way to configure default. Consider a short note on those two flags pointing users to--schedule-type Weeklyas the modern alternative — otherwise users hitting--helpwon't discover the new path.