Updating an Auto Scaling Policy
Function
This API is used to update an auto scaling policy.
Constraints
None
Debugging
You can debug this API in API Explorer. Automatic authentication is supported. API Explorer can automatically generate sample SDK code and support sample SDK code debugging.
URI
PUT /v2/{project_id}/autoscaling-policy/{cluster_id}
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
project_id |
Yes |
String |
Project ID. |
cluster_id |
Yes |
String |
Cluster ID. |
Request Parameters
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
node_group_name |
Yes |
String |
Node group name. This parameter is mandatory. If resource_pool_name is set to default, the auto scaling policies are created by node group. If resource_pool_name is not set to default, policies of the resource pool corresponding to the node group are created. |
resource_pool_name |
Yes |
String |
Pool name. This parameter is mandatory. If the cluster version does not support auto scaling for a specified resource pool, set this parameter to default. If this parameter is not default, the auto scaling policy of the specified resource pool is deleted. |
auto_scaling_policy |
No |
AutoScalingPolicyInfo object |
Auto scaling rule. For details about the parameters, see Table 3. |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
auto_scaling_enable |
Yes |
Boolean |
Whether to enable the auto scaling policy. |
min_capacity |
Yes |
Integer |
Minimum number of nodes allowed in the node group. Value range: [0, 500] |
max_capacity |
Yes |
Integer |
The maximum number of nodes in the node group. Value range: [0, 500] |
resources_plans |
No |
Array of ResourcesPlan objects |
Resource plans. For details, see Table 4. If this parameter is left blank, the resource plan is disabled. When auto_scaling_enable is set to true, either this parameter or rules must be configured. |
rules |
No |
Array of Rule objects |
Auto scaling rules. When auto_scaling_enable is set to true, either this parameter or resources_plans must be configured. For details about this parameter, see Table 5. |
tags |
No |
Array of Tag objects |
Tags of an auto scaling rule. For details about the parameters, see Table 7. |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
period_type |
Yes |
String |
The cycle type of a resource plan. Currently, only the following cycle type is supported: daily |
start_time |
Yes |
String |
The start time of a resource plan. The value is in the format of hour:minute, indicating that the time ranges from 00:00 to 23:59. |
end_time |
Yes |
String |
The end time of a resource plan. The value is in the same format as that of start_time. The interval between end_time and start_time must be greater than or equal to 30 minutes. |
min_capacity |
Yes |
Integer |
The minimum number of reserved nodes in a node group in a resource plan. Value range: [0, 500] |
max_capacity |
Yes |
Integer |
The maximum number of reserved nodes in a node group in a resource plan. Value range: [0, 500] |
effective_days |
No |
Array of strings |
The effective date of a resource plan. If this parameter is left blank, it indicates that the resource plan takes effect every day. The options are as follows: MONDAY, TUESDAY, WEDNESDAY, THURSDAY, FRIDAY, SATURDAY, and SUNDAY |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
name |
Yes |
String |
The name of an auto scaling rule. A cluster name can contain only 1 to 64 characters. Only letters, digits, hyphens (-), and underscores (_) are allowed. Rule names must be unique in a node group. |
description |
No |
String |
The description about an auto scaling rule. It contains a maximum of 1,024 characters. |
adjustment_type |
Yes |
String |
The adjustment type of an auto scaling rule. The options are as follows:
|
cool_down_minutes |
Yes |
Integer |
The cluster cooling time after an auto scaling rule is triggered, in minutes, during which period no auto scaling operation is performed. Value range: [0,10080]. One week is equal to 10,080 minutes. |
scaling_adjustment |
Yes |
Integer |
The number of cluster nodes that can be adjusted at a time. Value range: [1, 100] |
trigger |
Yes |
Trigger object |
Condition for triggering a rule. For details, see Table 6. |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
metric_name |
Yes |
String |
Metric name. This triggering condition makes a judgment according to the value of the metric. A metric name contains a maximum of 64 characters. |
metric_value |
Yes |
String |
The metric threshold to trigger a rule. The value must be an integer or a number with two decimal places. |
comparison_operator |
No |
String |
The metric judgment operator. The options are as follows:
|
evaluation_periods |
Yes |
Integer |
The number of consecutive five-minute periods, during which a metric threshold is reached. The value ranges from 1 to 288. |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
key |
Yes |
String |
The tag key.
|
value |
Yes |
String |
The tag value.
|
Response Parameters
None
Example Request
Update an auto scaling policy, set the number of node groups in node_group_1 to 0 to 5, and configure two scaling rules. If the value of YARNAppRunning is greater than or equal to 75 for one 5-minute period, add one Task node. If the value of YARNAppRunning is less than or equal to 25 for one 5-minute period, stop one Task node. The cooling duration is 20 minutes, and the aaa=bbb label is added to the involved nodes.
/v2/{project_id}/autoscaling-policy/{cluster_id} { "node_group_name" : "ttt", "auto_scaling_policy" : { "auto_scaling_enable" : true, "min_capacity" : 0, "max_capacity" : 5, "rules" : [ { "name" : "default-expand-1", "adjustment_type" : "scale_out", "cool_down_minutes" : 20, "scaling_adjustment" : 1, "trigger" : { "metric_name" : "YARNAppRunning", "metric_value" : 75, "comparison_operator" : "GT", "evaluation_periods" : 1 } }, { "name" : "default-shrink-1", "adjustment_type" : "scale_in", "cool_down_minutes" : 20, "scaling_adjustment" : 1, "trigger" : { "metric_name" : "YARNAppRunning", "metric_value" : 25, "comparison_operator" : "LT", "evaluation_periods" : 1 } } ], "resources_plans" : [ { "period_type" : "daily", "start_time" : "06:00", "end_time" : "20:00", "min_capacity" : "0", "max_capacity" : "2", "effective_days" : null } ], "tags" : [ { "key" : "aaa", "value" : "bbb" } ] }, "resource_pool_name" : "default" }
Example Response
None
Status Codes
For details, see Status Codes.
Error Codes
See Error Codes.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot