Skip to content
Open
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
48 changes: 28 additions & 20 deletions src/azure-cli/azure/cli/command_modules/acs/_help.py
Original file line number Diff line number Diff line change
Expand Up @@ -1487,16 +1487,16 @@
parameters:
- name: --weekday
type: string
short-summary: A day in week on which maintenance is allowed. E.g. Monday. Applicable to default maintenance configuration only.
short-summary: A day in week on which maintenance is allowed. E.g. Monday. Applicable to default maintenance configuration only, using the legacy timeInWeek format. Use --schedule-type Weekly with --day-of-week, --start-time, and --duration instead for the maintenanceWindow format, which also supports --utc-offset and --start-date.
- name: --start-hour
type: string
short-summary: The start time of 1 hour window which maintenance is allowd. E.g. 1 means it's allowd between 1:00 am and 2:00 am. Applicable to default maintenance configuration only.
short-summary: The start of a 1-hour maintenance window. E.g. 1 means maintenance is allowed between 1:00am and 2:00am. Applicable to default maintenance configuration only, using the legacy timeInWeek format. Use --schedule-type Weekly with --start-time and --duration instead for the maintenanceWindow format, which also supports --utc-offset and --start-date.
- name: --schedule-type
type: string
short-summary: Choose either 'Daily', 'Weekly', 'AbsoluteMonthly' or 'RelativeMonthly' for your maintenance schedule. Only applicable to 'aksManagedAutoUpgradeSchedule' and 'aksManagedNodeOSUpgradeSchedule' maintenance configuration.
short-summary: Choose either 'Daily', 'Weekly', 'AbsoluteMonthly' or 'RelativeMonthly' for your maintenance schedule. For default maintenance configuration, only 'Weekly' is supported.
- name: --start-date
type: string
short-summary: The date the maintenance configuration activates. If not specified, the maintenance window will be active right away."
short-summary: The date the maintenance configuration activates. If not specified, the maintenance window will be active right away. Supported for all configuration types, including default."
- name: --start-time
type: string
short-summary: The start time of the maintenance window. Accepted values are from '00:00' to '23:59'. '--utc-offset' applies to this field. For example, '02:00' with '--utc-offset +02:00' means UTC time '00:00'.
Expand All @@ -1505,25 +1505,25 @@
short-summary: The length of maintenance window range from 4 to 24 hours.
- name: --utc-offset
type: string
short-summary: The UTC offset in format +/-HH:mm. For example, '+05:30' for IST and '-07:00' for PST. If not specified, the default is '+00:00'.
short-summary: The UTC offset in format +/-HH:mm. For example, '+05:30' for IST and '-07:00' for PST. If not specified, the default is '+00:00'. Supported for all configuration types, including default.
- name: --interval-days
type: int
short-summary: The number of days between each set of occurrences for daily schedule type.
short-summary: The number of days between each set of occurrences for daily schedule type. Not applicable to default maintenance configuration.
- name: --interval-weeks
type: int
short-summary: The number of weeks between each set of occurrences. Applicable to weekly schedule types only.
short-summary: The number of weeks between each set of occurrences. Applicable to weekly schedule types only. Cannot be specified for default maintenance configuration (the interval is always 1 week).
- name: --interval-months
type: int
short-summary: The number of months between each set of occurrences. Applicable to absolute and relative monthly schedule types.
short-summary: The number of months between each set of occurrences. Applicable to absolute and relative monthly schedule types. Not applicable to default maintenance configuration.
- name: --day-of-week
type: string
short-summary: Specify on which day of the week the maintenance occurs. E.g. "Monday". Applicable to weekly and relative monthly schedule types.
- name: --day-of-month
type: int
short-summary: Specify on which day of the month the maintenance occurs. E.g. 1 indicates the 1st of the month. Applicable to absolute monthly schedule type only.
short-summary: Specify on which day of the month the maintenance occurs. E.g. 1 indicates the 1st of the month. Applicable to absolute monthly schedule type only. Not applicable to default maintenance configuration.
- name: --week-index
type: string
short-summary: Specify on which instance of the allowed days specified in '--day-of-week' the maintenance occurs. Applicable to relative monthly schedule type only.
short-summary: Specify on which instance of the allowed days specified in '--day-of-week' the maintenance occurs. Applicable to relative monthly schedule type only. Not applicable to default maintenance configuration.
- name: --config-file
type: string
short-summary: The maintenance configuration json file.
Expand Down Expand Up @@ -1569,6 +1569,10 @@
}
]
}
- name: Add default maintenance configuration with weekly maintenanceWindow schedule.
text: |
az aks maintenanceconfiguration add -g MyResourceGroup --cluster-name test1 -n default --schedule-type Weekly --day-of-week Monday --duration 4 --start-time 09:00
The maintenance is allowed on Monday from 09:00 to 13:00 (UTC) every week. Use --utc-offset to adjust the timezone and --start-date to set an activation date.
- name: Add aksManagedNodeOSUpgradeSchedule maintenance configuration with daily schedule.
text: |
az aks maintenanceconfiguration add -g MyResourceGroup --cluster-name test1 -n aksManagedNodeOSUpgradeSchedule --schedule-type Daily --interval-days 2 --duration 12 --utc-offset=-08:00 --start-date 2023-01-16 --start-time 00:00
Expand Down Expand Up @@ -1621,16 +1625,16 @@
parameters:
- name: --weekday
type: string
short-summary: A day in week on which maintenance is allowed. E.g. Monday. Applicable to default maintenance configuration only.
short-summary: A day in week on which maintenance is allowed. E.g. Monday. Applicable to default maintenance configuration only, using the legacy timeInWeek format. Use --schedule-type Weekly with --day-of-week, --start-time, and --duration instead for the maintenanceWindow format, which also supports --utc-offset and --start-date.
- name: --start-hour
type: string
short-summary: The start time of 1 hour window which maintenance is allowd. E.g. 1 means it's allowd between 1:00 am and 2:00 am. Applicable to default maintenance configuration only.
short-summary: The start of a 1-hour maintenance window. E.g. 1 means maintenance is allowed between 1:00am and 2:00am. Applicable to default maintenance configuration only, using the legacy timeInWeek format. Use --schedule-type Weekly with --start-time and --duration instead for the maintenanceWindow format, which also supports --utc-offset and --start-date.
- name: --schedule-type
type: string
short-summary: Choose either 'Daily', 'Weekly', 'AbsoluteMonthly' or 'RelativeMonthly' for your maintenance schedule. Only applicable to 'aksManagedAutoUpgradeSchedule' and 'aksManagedNodeOSUpgradeSchedule' maintenance configuration.
short-summary: Choose either 'Daily', 'Weekly', 'AbsoluteMonthly' or 'RelativeMonthly' for your maintenance schedule. For default maintenance configuration, only 'Weekly' is supported.
Comment thread
anushkasingh16 marked this conversation as resolved.
- name: --start-date
type: string
short-summary: The date the maintenance configuration activates. If not specified, the maintenance window will be active right away."
short-summary: The date the maintenance configuration activates. If not specified, the maintenance window will be active right away. Supported for all configuration types, including default."
- name: --start-time
type: string
short-summary: The start time of the maintenance window. Accepted values are from '00:00' to '23:59'. '--utc-offset' applies to this field. For example, '02:00' with '--utc-offset +02:00' means UTC time '00:00'.
Expand All @@ -1639,25 +1643,25 @@
short-summary: The length of maintenance window range from 4 to 24 hours.
- name: --utc-offset
type: string
short-summary: The UTC offset in format +/-HH:mm. For example, '+05:30' for IST and '-07:00' for PST. If not specified, the default is '+00:00'.
short-summary: The UTC offset in format +/-HH:mm. For example, '+05:30' for IST and '-07:00' for PST. If not specified, the default is '+00:00'. Supported for all configuration types, including default.
- name: --interval-days
type: int
short-summary: The number of days between each set of occurrences for daily schedule type.
short-summary: The number of days between each set of occurrences for daily schedule type. Not applicable to default maintenance configuration.
- name: --interval-weeks
type: int
short-summary: The number of weeks between each set of occurrences. Applicable to weekly schedule types only.
short-summary: The number of weeks between each set of occurrences. Applicable to weekly schedule types only. Cannot be specified for default maintenance configuration (the interval is always 1 week).
- name: --interval-months
type: int
short-summary: The number of months between each set of occurrences. Applicable to absolute and relative monthly schedule types.
short-summary: The number of months between each set of occurrences. Applicable to absolute and relative monthly schedule types. Not applicable to default maintenance configuration.
- name: --day-of-week
type: string
short-summary: Specify on which day of the week the maintenance occurs. E.g. "Monday". Applicable to weekly and relative monthly schedule types.
- name: --day-of-month
type: int
short-summary: Specify on which day of the month the maintenance occurs. E.g. 1 indicates the 1st of the month. Applicable to absolute monthly schedule type only.
short-summary: Specify on which day of the month the maintenance occurs. E.g. 1 indicates the 1st of the month. Applicable to absolute monthly schedule type only. Not applicable to default maintenance configuration.
- name: --week-index
type: string
short-summary: Specify on which instance of the allowed days specified in '--day-of-week' the maintenance occurs. Applicable to relative monthly schedule type only.
short-summary: Specify on which instance of the allowed days specified in '--day-of-week' the maintenance occurs. Applicable to relative monthly schedule type only. Not applicable to default maintenance configuration.
- name: --config-file
type: string
short-summary: The maintenance configuration json file.
Expand Down Expand Up @@ -1703,6 +1707,10 @@
}
]
}
- name: Update default maintenance configuration with weekly maintenanceWindow schedule.
text: |
az aks maintenanceconfiguration update -g MyResourceGroup --cluster-name test1 -n default --schedule-type Weekly --day-of-week Monday --duration 4 --start-time 09:00
The maintenance is allowed on Monday from 09:00 to 13:00 (UTC) every week. Use --utc-offset to adjust the timezone and --start-date to set an activation date.
- name: Update aksManagedNodeOSUpgradeSchedule maintenance configuration with daily schedule.
text: |
az aks maintenanceconfiguration update -g MyResourceGroup --cluster-name test1 -n aksManagedNodeOSUpgradeSchedule --schedule-type Daily --interval-days 2 --duration 12 --utc-offset=-08:00 --start-date 2023-01-16 --start-time 00:00
Expand Down
2 changes: 1 addition & 1 deletion src/azure-cli/azure/cli/command_modules/acs/_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -1049,7 +1049,7 @@ def load_arguments(self, _):
c.argument('weekday', help='Weekday on which maintenance can happen. e.g. Monday')
c.argument('start_hour', type=int, help='Maintenance start hour of 1 hour window on the weekday. e.g. 1 means 1:00am - 2:00am')
c.argument('schedule_type', arg_type=get_enum_type(schedule_types),
help='Schedule type for non-default maintenance configuration.')
help='Schedule type for maintenance configuration. For default configuration, only Weekly is supported.')
c.argument('interval_days', type=int, help='The number of days between each set of occurrences for Daily schedule.')
c.argument('interval_weeks', type=int, help='The number of weeks between each set of occurrences for Weekly schedule.')
c.argument('interval_months', type=int, help='The number of months between each set of occurrences for AbsoluteMonthly or RelativeMonthly schedule.')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,30 @@ 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.')
if raw_parameters.get("interval_weeks") is not None:
raise InvalidArgumentValueError('--interval-weeks cannot be specified for default maintenance configuration; the interval is always 1 week.')
if any(raw_parameters.get(p) is not None for p in ("interval_days", "interval_months", "day_of_month", "week_index")):
raise MutuallyExclusiveArgumentError('--interval-days, --interval-months, --day-of-month and --week-index cannot be used for default maintenance configuration.')
raw_parameters["interval_weeks"] = 1
maintenance_configuration_models = AKSManagedClusterModels(cmd, ResourceType.MGMT_CONTAINERSERVICE).maintenance_configuration_models
Comment thread
anushkasingh16 marked this conversation as resolved.
MaintenanceConfiguration = (
maintenance_configuration_models.MaintenanceConfiguration
)
maintenanceConfiguration = MaintenanceConfiguration()
# utc_offset and start_date are intentionally not validated here: the RP accepts the full
# MaintenanceWindow schema (including these optional fields) for all maintenance config types.
maintenanceConfiguration.maintenance_window = constructMaintenanceWindow(cmd, raw_parameters)
return maintenanceConfiguration

# 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 = (
Expand All @@ -73,13 +93,13 @@ def constructDefaultMaintenanceConfiguration(cmd, raw_parameters):
timeInWeek_dict["day"] = weekday
timeInWeek_dict["hour_slots"] = [start_hour]
timeInWeek = TimeInWeek(**timeInWeek_dict)
Result = (
MaintenanceConfiguration = (
maintenance_configuration_models.MaintenanceConfiguration
)
result = Result()
result.time_in_week = [timeInWeek]
result.not_allowed_time = []
return result
maintenanceConfiguration = MaintenanceConfiguration()
maintenanceConfiguration.time_in_week = [timeInWeek]
maintenanceConfiguration.not_allowed_time = []
return maintenanceConfiguration


def constructDedicatedMaintenanceConfiguration(cmd, raw_parameters):
Expand All @@ -89,12 +109,12 @@ def constructDedicatedMaintenanceConfiguration(cmd, raw_parameters):
raise MutuallyExclusiveArgumentError('--weekday and --start-hour are only applicable to default maintenance configuration.')

maintenance_configuration_models = AKSManagedClusterModels(cmd, ResourceType.MGMT_CONTAINERSERVICE).maintenance_configuration_models
Result = (
MaintenanceConfiguration = (
maintenance_configuration_models.MaintenanceConfiguration
)
result = Result()
result.maintenance_window = constructMaintenanceWindow(cmd, raw_parameters)
return result
maintenanceConfiguration = MaintenanceConfiguration()
maintenanceConfiguration.maintenance_window = constructMaintenanceWindow(cmd, raw_parameters)
return maintenanceConfiguration


def constructMaintenanceWindow(cmd, raw_parameters):
Expand Down
Loading
Loading