如何使用备用后端修补路由

时间:2018-11-20 18:53:16

标签: openshift openshift-client-tools openshift-enterprise

我一直试图在openshift中修补具有备用后端的路由。

我尝试过:

  1. codes

错误:static func fetchCodes(person: Person) -> [Codes] { return person.codes }

  1. 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

  1. 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"]}}'

我一直在尝试遵循documentation,但没有成功。

Openshift信息:

Error from server: cannot restore struct from: string

1 个答案:

答案 0 :(得分:2)

这种格式怎么样?如果更改不算什么,则patch命令将不更改而结束。

oc patch route/image-mirror-poc --patch'{"spec": {"alternateBackends": [{"kind": "Service","name": "image-mirror-poc-blue","weight": 75}]}}'