-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathautoscaler-config.schema.json
367 lines (367 loc) · 15.4 KB
/
autoscaler-config.schema.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
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
{
"$schema": "http://json-schema.org/draft-07/schema#",
"$id": "https://github.com/GoogleCloudPlatform/memorystore-cluster-autoscaler/autoscaler-config.schema.json",
"title": "Memorystore Cluster Autoscaler configuration",
"description": "JSON schema for the Cloud Memorystore autoscaler, specifying one or more Memorystore clusters to monitor and automatically scale.",
"type": "array",
"minItems": 1,
"items": {
"$ref": "#/$defs/memorystoreInstance"
},
"$comment": "Any changes to this file also need to be reflected in src/poller/README.md, and in autoscaler-common/types.js.",
"$defs": {
"memorystoreInstance": {
"type": "object",
"title": "Memorystore Cluster",
"description": "Specification of a Cloud Memorystore cluster to be managed by the autoscaler.",
"additionalProperties": false,
"required": ["projectId", "regionId", "clusterId"],
"properties": {
"$comment": {
"type": "string"
},
"projectId": {
"type": "string",
"minLength": 2,
"description": "Project ID of the Cloud Memorystore cluster to be monitored."
},
"regionId": {
"type": "string",
"minLength": 2,
"description": "Region ID of the Cloud Memorystore cluster to be monitored."
},
"clusterId": {
"type": "string",
"minLength": 2,
"description": "Instance ID of the Cloud Memorystore cluster to be monitored."
},
"units": {
"enum": ["SHARDS"],
"description": "Specifies the units how the Cloud Memorystore cluster capacity will be measured.",
"default": "SHARDS"
},
"minSize": {
"type": "number",
"minimum": 1,
"description": "Minimum number of Cloud Memorystore cluster `SHARDS` that the instance can be scaled IN to.",
"default": "3 SHARDS"
},
"maxSize": {
"type": "number",
"minimum": 1,
"description": "Maximum number of Cloud Memorystore cluster `SHARDS` that the instance can be scaled OUT to.",
"default": "10 SHARDS"
},
"scalingProfile": {
"type": "string",
"minLength": 2,
"description": "Scaling profile that should be used. See the [scaling profiles](https://github.com/GoogleCloudPlatform/memorystore-cluster-autoscaler/blob/main/src/scaler/README.md#scaling-profiles) for more information.",
"default": "CPU_AND_MEMORY"
},
"scalingMethod": {
"type": "string",
"minLength": 2,
"description": "Scaling method that should be used. See the [scaling methods](https://github.com/GoogleCloudPlatform/memorystore-cluster-autoscaler/blob/main/src/scaler/README.md#scaling-methods) for more information.",
"default": "STEPWISE"
},
"stepSize": {
"type": "number",
"minimum": 1,
"description": "Amount of capacity that should be added or removed when scaling with the STEPWISE method.",
"default": "1 SHARD"
},
"scaleInLimit": {
"type": "number",
"minimum": 0,
"description": "Maximum number of shards that can be removed on a single step when scaling with the `LINEAR` method. If `undefined` or `0`, it will not limit the number of shards.",
"default": 0
},
"scaleOutLimit": {
"type": "number",
"minimum": 0,
"description": "Maximum number of shards that can be added on a single step when scaling with the `LINEAR` method. If `undefined` or `0`, it will not limit the number of shards.",
"default": 0
},
"minFreeMemoryPercent": {
"type": "number",
"minimum": 1,
"maximum": 100,
"description": "Percentage of total memory to maintain as safety (i.e. free, unused) headroom.",
"default": 30
},
"scaleOutCoolingMinutes": {
"type": "number",
"minimum": 1,
"description": "Minutes to wait after scaling IN or OUT before a scale OUT event can be processed.",
"default": 5
},
"scaleInCoolingMinutes": {
"type": "number",
"minimum": 1,
"description": "Minutes to wait after scaling IN or OUT before a scale IN event can be processed.",
"default": 30
},
"stateProjectId": {
"type": "string",
"minLength": 2,
"description": "The project ID where the Autoscaler state will be persisted.\nBy default it is persisted using Cloud Firestore in the same project as the Memorystore instance being scaled - see `stateDatabase`.",
"default": "${projectId}"
},
"stateDatabase": {
"type": "object",
"description": "Object defining the database for managing the state of the Autoscaler.",
"default": "firestore",
"additionalProperties": false,
"properties": {
"name": {
"enum": ["firestore", "spanner"],
"description": "Type of the database for storing the persistent state of the Autoscaler.",
"default": "firestore"
},
"instanceId": {
"type": "string",
"minLength": 2,
"description": "The instance id of Cloud Memorystore cluster in which you want to persist the state. Required if name=spanner."
},
"databaseId": {
"type": "string",
"minLength": 2,
"description": "The instance id of Cloud Memorystore cluster in which you want to persist the state. Required if name=spanner."
}
}
},
"scalerPubSubTopic": {
"type": "string",
"minLength": 2,
"pattern": "^projects/[^/]+/topics/[^/]+$",
"description": "PubSub topic (in the form `projects/${projectId}/topics/scaler-topic`) for the Poller function to publish messages for the Scaler function (Required for Cloud Run functions deployments)."
},
"downstreamPubSubTopic": {
"type": "string",
"minLength": 2,
"pattern": "^projects/[^/]+/topics/[^/]+$",
"description": "Set this parameter to point to a pubsub topic (in the form `projects/${projectId}/topics/downstream-topic-name`) to make the Autoscaler publish events that can be consumed by downstream applications.\nSee [Downstream messaging](https://github.com/cloudspannerecosystem/autoscaler/blob/main/src/scaler/README.md#downstream-messaging) for more information."
},
"scalingRules": {
"type": "array",
"minItems": 1,
"description": "Array containing rules for custom scaling",
"items": {
"$ref": "#/$defs/scalingRule"
}
}
}
},
"scalingRule": {
"type": "object",
"title": "Scaling Rule",
"description": "A Scaling Rule contains a set of conditions and a single event. When the engine is run, each rule condition is evaluated. If the results are truthy, the rule's event is triggered.",
"required": ["conditions", "event"],
"properties": {
"name": {
"$id": "#/defs/scalingRule/properties/name",
"anyOf": [
{
"type": "string"
}
],
"title": "The Name Schema",
"description": "A way of naming your rules, allowing them to be easily identifiable in Rule Results. Note that the name need not be unique, and that it has no impact on execution of the rule.",
"default": {},
"examples": ["My Rule Name"]
},
"priority": {
"$id": "#/defs/scalingRule/properties/priority",
"anyOf": [
{
"type": "integer",
"minimum": 1
}
],
"title": "Priority",
"description": "Dictates when rule should be run, relative to other rules. Higher priority rules are run before lower priority rules. Rules with the same priority are run in parallel. Priority must be a positive, non-zero integer.",
"default": 1,
"examples": [1]
},
"conditions": {
"$ref": "#/defs/scalingRule/definitions/conditions"
},
"event": {
"$id": "#/defs/scalingRule/properties/event",
"type": "object",
"title": "The Event Schema",
"description": "Sets the on('success') and on('failure') event argument emitted whenever the rule passes. Event objects must have a type property, and an optional params property.",
"default": {},
"required": ["type", "params"],
"properties": {
"type": {
"$id": "#/defs/scalingRule/properties/event/properties/type",
"enum": ["IN", "OUT"],
"title": "Event Type",
"description": "A string representing the scaling event this describes.",
"default": ""
},
"params": {
"$id": "#/defs/scalingRule/properties/event/properties/params",
"type": "object",
"title": "Event Params",
"description": "Params to make available to the event processor.",
"required": ["message", "scalingMetrics"],
"examples": [
{
"message": "Low average memory utilization",
"scalingMetrics": "['memory_average_utilization']"
}
]
}
}
}
},
"definitions": {
"conditions": {
"$id": "#/defs/scalingRule/definitions/conditions",
"type": "object",
"title": "Conditions",
"description": "Rule conditions are a combination of facts, operators, and values that determine whether the rule is a success or a failure. The simplest form of a condition consists of a fact, an operator, and a value. When the engine runs, the operator is used to compare the fact against the value. Each rule's conditions must have either an all or an any operator at its root, containing an array of conditions. The all operator specifies that all conditions contained within must be truthy for the rule to be considered a success. The any operator only requires one condition to be truthy for the rule to succeed.",
"default": {},
"examples": [
{
"all": [
{
"value": true,
"fact": "displayMessage",
"operator": "equal"
}
]
}
],
"oneOf": [
{
"required": ["any"]
},
{
"required": ["all"]
}
],
"properties": {
"any": {
"$ref": "#/defs/scalingRule/definitions/conditions/conditionArray"
},
"all": {
"$ref": "#/defs/scalingRule/definitions/conditions/conditionArray"
}
}
},
"conditionArray": {
"$id": "#/defs/scalingRule/definitions/conditions/conditionArray",
"type": "array",
"title": "Condition Array",
"description": "An array of conditions with a possible recursive inclusion of another condition array.",
"default": [],
"items": {
"anyOf": [
{
"$ref": "#/defs/scalingRule/definitions/conditions"
},
{
"$ref": "#/defs/scalingRule/definitions/condition"
}
]
}
},
"condition": {
"$id": "#/defs/scalingRule/definitions/condition",
"type": "object",
"title": "Condition",
"description": "Rule conditions are a combination of facts, operators, and values that determine whether the rule is a success or a failure. The simplest form of a condition consists of a fact, an operator, and a value. When the engine runs, the operator is used to compare the fact against the value. Sometimes facts require additional input to perform calculations. For this, the params property is passed as an argument to the fact handler. params essentially functions as fact arguments, enabling fact handlers to be more generic and reusable.",
"default": {
"fact": "my-fact",
"operator": "lessThanInclusive",
"value": 1
},
"required": ["fact", "operator", "value"],
"properties": {
"fact": {
"type": "string",
"title": "Fact",
"description": "Facts are methods or constants registered with the engine prior to runtime and referenced within rule conditions. Each fact method should be a pure function that may return a either computed value, or promise that resolves to a computed value. As rule conditions are evaluated during runtime, they retrieve fact values dynamically and use the condition operator to compare the fact result with the condition value.",
"default": ""
},
"operator": {
"type": "string",
"anyOf": [
{
"const": "equal",
"title": "fact must equal value"
},
{
"const": "notEqual",
"title": "fact must not equal value"
},
{
"const": "lessThan",
"title": "fact must be less than value"
},
{
"const": "lessThanInclusive",
"title": "fact must be less than or equal to value"
},
{
"const": "greaterThan",
"title": "fact must be greater than value"
},
{
"const": "greaterThanInclusive",
"title": "fact must be greater than or equal to value"
},
{
"const": "in",
"title": "fact must be included in value (an array)"
},
{
"const": "notIn",
"title": "fact must not be included in value (an array)"
},
{
"const": "contains",
"title": "fact (an array) must include value"
},
{
"const": "doesNotContain",
"title": "fact (an array) must not include value"
}
],
"title": "Operator",
"description": "The operator compares the value returned by the fact to what is stored in the value property. If the result is truthy, the condition passes.",
"default": "",
"examples": ["equal"]
},
"value": {
"anyOf": [
{
"type": "string"
},
{
"type": "object"
},
{
"type": "array"
},
{
"type": "number"
},
{
"type": "boolean"
}
],
"title": "Value",
"description": "The value the fact should be compared to.",
"default": 0,
"examples": [40]
}
}
}
}
}
}
}