我在Bluemix用户界面中创建了一个自动缩放功能,然后保存它,然后使用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中的计划中指定至少一个计划规则:App xxxxx的创建/更新策略。”}
解决方法是删除scheduleles元素:
{
"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
}
]
}
问题:为什么用户界面没有抱怨时间表,并允许我导出API调用不喜欢的无效时间表?