/
AKS_Maintenance_DINE.json
312 lines (312 loc) · 13 KB
/
AKS_Maintenance_DINE.json
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
{
"properties": {
"policyType": "BuiltIn",
"displayName": "Deploy Planned Maintenance to schedule and control upgrades for your Azure Kubernetes Service (AKS) cluster",
"description": "Planned Maintenance allows you to schedule weekly maintenance windows to perform updates and minimize workload impact. Once scheduled, upgrades occur only during the window you selected. Learn more at: https://aka.ms/aks/planned-maintenance",
"metadata": {
"version": "1.0.0",
"category": "Kubernetes"
},
"version": "1.0.0",
"mode": "Indexed",
"parameters": {
"effect": {
"type": "String",
"defaultValue": "DeployIfNotExists",
"allowedValues": [
"DeployIfNotExists",
"AuditIfNotExists",
"Disabled"
],
"metadata": {
"displayName": "Effect",
"description": "Enable or disable the execution of the policy",
"portalReview": true
}
},
"configurationType": {
"type": "String",
"allowedValues": [
"aksManagedAutoUpgradeSchedule",
"aksManagedNodeOSUpgradeSchedule"
],
"metadata": {
"displayName": "Planned Maintenance Configuration Type",
"description": "The planned maintenance configuration type for the policy. Only aksManagedAutoUpgradeSchedule and aksManagedNodeOSUpgradeSchedule are allowed. Each assignment can only assign one type"
}
},
"maintenanceWindow": {
"type": "Object",
"metadata": {
"displayName": "Maintenance Window Configuration",
"description": "Use a JSON file create a maintenance configuration. Learn more at https://aka.ms/aks/planned-maintenance#add-a-maintenance-window-configuration-with-a-json-file"
},
"schema": {
"type": "object",
"required": [
"properties"
],
"properties": {
"properties": {
"type": "object",
"required": [
"maintenanceWindow"
],
"properties": {
"maintenanceWindow": {
"type": "object",
"properties": {
"schedule": {
"type": "object",
"properties": {
"daily": {
"type": "object",
"properties": {
"intervalDays": {
"type": "integer",
"format": "int32",
"minimum": 1,
"maximum": 7,
"description": "Specifies the number of days between each set of occurrences."
}
},
"description": "For schedules like: 'recur every day' or 'recur every 3 days'.",
"required": [
"intervalDays"
]
},
"weekly": {
"type": "object",
"properties": {
"intervalWeeks": {
"type": "integer",
"format": "int32",
"minimum": 1,
"maximum": 4,
"description": "Specifies the number of weeks between each set of occurrences."
},
"dayOfWeek": {
"type": "string",
"enum": [
"Sunday",
"Monday",
"Tuesday",
"Wednesday",
"Thursday",
"Friday",
"Saturday"
],
"x-ms-enum": {
"name": "WeekDay",
"modelAsString": true
},
"description": "Specifies on which day of the week the maintenance occurs."
}
},
"description": "For schedules like: 'recur every Monday' or 'recur every 3 weeks on Wednesday'.",
"required": [
"intervalWeeks",
"dayOfWeek"
]
},
"absoluteMonthly": {
"type": "object",
"properties": {
"intervalMonths": {
"type": "integer",
"format": "int32",
"minimum": 1,
"maximum": 6,
"description": "Specifies the number of months between each set of occurrences."
},
"dayOfMonth": {
"type": "integer",
"format": "int32",
"minimum": 1,
"maximum": 31,
"description": "The date of the month."
}
},
"description": "For schedules like: 'recur every month on the 15th' or 'recur every 3 months on the 20th'.",
"required": [
"intervalMonths",
"dayOfMonth"
]
},
"relativeMonthly": {
"type": "object",
"properties": {
"intervalMonths": {
"type": "integer",
"format": "int32",
"minimum": 1,
"maximum": 6,
"description": "Specifies the number of months between each set of occurrences."
},
"weekIndex": {
"type": "string",
"enum": [
"First",
"Second",
"Third",
"Fourth",
"Last"
],
"x-ms-enum": {
"name": "type",
"modelAsString": true
},
"description": "Specifies on which instance of the allowed days specified in daysOfWeek the maintenance occurs."
},
"dayOfWeek": {
"type": "string",
"enum": [
"Sunday",
"Monday",
"Tuesday",
"Wednesday",
"Thursday",
"Friday",
"Saturday"
],
"x-ms-enum": {
"name": "WeekDay",
"modelAsString": true
},
"description": "Specifies on which day of the week the maintenance occurs."
}
},
"description": "For schedules like: 'recur every month on the first Monday' or 'recur every 3 months on last Friday'.",
"required": [
"intervalMonths",
"weekIndex",
"dayOfWeek"
]
}
}
},
"durationHours": {
"type": "integer",
"format": "int32",
"minimum": 4,
"maximum": 24,
"default": 24,
"description": "Length of maintenance window range from 4 to 24 hours."
},
"utcOffset": {
"type": "string",
"pattern": "^(-|\\+)[0-9]{2}:[0-9]{2}$",
"description": "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'."
},
"startDate": {
"type": "string",
"format": "date",
"description": "The date the maintenance window activates. If the current date is before this date, the maintenance window is inactive and will not be used for upgrades. If not specified, the maintenance window will be active right away."
},
"startTime": {
"type": "string",
"pattern": "^\\d{2}:\\d{2}$",
"description": "The start time of the maintenance window. Accepted values are from '00:00' to '23:59'. 'utcOffset' applies to this field. For example: '02:00' with 'utcOffset: +02:00' means UTC time '00:00'."
},
"notAllowedDates": {
"type": "array",
"items": {
"type": "object",
"properties": {
"start": {
"type": "string",
"format": "date"
},
"end": {
"type": "string",
"format": "date"
}
},
"description": "For example, between '2022-12-23' and '2023-01-05'.",
"required": [
"start",
"end"
]
},
"x-ms-identifiers": []
}
},
"description": "Maintenance window used to configure scheduled auto-upgrade for a Managed Cluster.",
"required": [
"schedule",
"durationHours",
"startTime"
]
}
}
}
}
}
}
},
"policyRule": {
"if": {
"field": "type",
"equals": "Microsoft.ContainerService/managedClusters"
},
"then": {
"effect": "[parameters('effect')]",
"details": {
"type": "Microsoft.ContainerService/managedClusters/maintenanceConfigurations",
"roleDefinitionIds": [
"/providers/Microsoft.Authorization/roleDefinitions/b24988ac-6180-42a0-ab88-20f7382dd24c"
],
"existenceCondition": {
"field": "name",
"equals": "[parameters('configurationType')]"
},
"deployment": {
"properties": {
"mode": "incremental",
"template": {
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"clusterName": {
"type": "string"
},
"configurationType": {
"type": "string"
},
"maintenanceWindow": {
"type": "object"
}
},
"variables": {},
"resources": [
{
"type": "Microsoft.ContainerService/managedClusters/maintenanceConfigurations",
"apiVersion": "2022-10-02-preview",
"name": "[concat(parameters('clusterName'), '/', parameters('configurationType'))]",
"properties": "[parameters('maintenanceWindow').properties]"
}
]
},
"parameters": {
"clusterName": {
"value": "[field('name')]"
},
"configurationType": {
"value": "[parameters('configurationType')]"
},
"maintenanceWindow": {
"value": "[parameters('maintenanceWindow')]"
}
}
}
}
}
}
},
"versions": [
"1.0.0"
]
},
"id": "/providers/Microsoft.Authorization/policyDefinitions/e1352e44-d34d-4e4d-a22e-451a15f759a1",
"name": "e1352e44-d34d-4e4d-a22e-451a15f759a1"
}