我在 Bluemix UI 中创建了一个自动缩放保存它,然后使用cf env
. 该政策是:
{
"policyState": "ENABLED",
"policyId": "",
"instanceMinCount": 2,
"instanceMaxCount": 5,
"policyTriggers": [
{
"metricType": "Memory",
"statWindow": 300,
"breachDuration": 600,
"lowerThreshold": 30,
"upperThreshold": 80,
"instanceStepCountDown": 1,
"instanceStepCountUp": 1,
"stepDownCoolDownSecs": 600,
"stepUpCoolDownSecs": 600
}
],
"schedules": {
"timezone": "(GMT +01:00) Africa/Algiers",
"recurringSchedule": null,
"specificDate": null
}
}
然后,我尝试从 IBM devops 部署阶段应用该策略:
curl https://ScalingAPI.ng.bluemix.net/v1/autoscaler/apps/xxxx/policy -X 'PUT' \
-H 'Content-Type:application/json' \
-H 'Accept:application/json' \
-H 'Authorization:Bearer *****' \
--data-binary @./autoscaling_policy.json \
-s -o response.txt -w '%{http_code}\n'
响应:
{"error" : "CWSCV6003E: 输入 JSON 字符串格式错误:应在 API 输入 JSON 中的调度中指定至少一个调度规则:为应用 xxxxx 创建/更新策略。"}
解决方法是删除 schedules 元素:
{
"policyState": "ENABLED",
"policyId": "",
"instanceMinCount": 2,
"instanceMaxCount": 5,
"policyTriggers": [
{
"metricType": "Memory",
"statWindow": 300,
"breachDuration": 600,
"lowerThreshold": 30,
"upperThreshold": 80,
"instanceStepCountDown": 1,
"instanceStepCountUp": 1,
"stepDownCoolDownSecs": 600,
"stepUpCoolDownSecs": 600
}
]
}
问题:为什么 UI 没有抱怨日程安排并允许我导出 API 调用不喜欢的无效日程安排?