我一直在尝试修补openshift中有备用后端的路由。
我试过:
oc patch route/image-mirror-poc --patch '{"spec":{"alternateBackends": "kind:Service" "name:image-mirror-poc-blue" "weight:75"}}'
错误:Error from server: invalid character '"' after object key:value pair
-
oc patch route/image-mirror-poc --patch '{"spec":{"alternateBackends": "kind:Service", "name:image-mirror-poc-blue", "weight:75"}}'
错误:Error from server: invalid character ',' after object key
-
oc patch route/image-mirror-poc --patch '{"spec":{"alternateBackends": ["kind:Service", "name:image-mirror-poc-blue", "weight:75"]}}'
错误:Error from server: cannot restore struct from: string
我提取了我路线的当前规格,它看起来像:
"spec": {
"alternateBackends": [
{
"kind": "Service",
"name": "image-mirror-poc-blue",
"weight": 75
}
],
"host": "image-mirror-poc.sbx1apps.ocp.delta.com",
"port": {
"targetPort": "8080-tcp"
},
"to": {
"kind": "Service",
"name": "image-mirror-poc-green",
"weight": 25
},
"wildcardPolicy": "None"
}
我一直试图遵循文档,但没有成功。
Openshift信息:
$ oc version
oc v3.9.0+191fece
kubernetes v1.9.1+a0ce1bc657
features: Basic-Auth
Server https://mycluster.ocp.mycompany.com
openshift v3.7.23
kubernetes v1.7.6+a08f5eeb6
这种格式怎么样?如果更改为零,则patch
命令结束时没有任何更改。
oc patch route/image-mirror-poc --patch'{"spec": {"alternateBackends": [{"kind": "Service","name": "image-mirror-poc-blue","weight": 75}]}}'