I can patch my ingress resource from cli with kubectl running following command:
kubectl patch ingress ingress-resource --type=json -p='[{"op": "replace", "path": "/spec/rules/0/http/paths/0/backend/service/name", "value":"node-app-blue-helm-chart"}]'
When I add following step to my cloudbuild.yaml and execute, it fails with following error.
Step #3: Running: kubectl patch ingress ingress-resource --type=json -p='[{"op": "replace", "path": "/spec/rules/0/http/paths/0/backend/service/name", "value":"node-app-blue-helm-chart"}]'
Step #3: Error from server (BadRequest): json: cannot unmarshal string into Go value of type jsonpatch.Patch
Finished Step #3
Step I used:
- name: 'gcr.io/cloud-builders/kubectl'
args:
- 'patch'
- 'ingress'
- 'ingress-resource'
- '--type=json'
- '-p=''[{"op": "replace", "path": "/spec/rules/0/http/paths/0/backend/service/name", "value":"node-app-green-helm-chart"}]'' '
env:
- 'CLOUDSDK_COMPUTE_ZONE=----'
- 'CLOUDSDK_CONTAINER_CLUSTER=----'
What can be missing?