Closed ghost closed 6 years ago
As an aside, I did the "same" change using oc patch
on the CLI. It was updated successfully.
$ oc patch dc my-app -p '{"spec":{"template":{"spec":{"containers":[{"name":"my-app","image":"myregistry.example.com/my-app@sha256:ea3aea0fdb9711d9b207b0c549fd1156bb
ae91ea1a5da75881316e514be6b1d4"}]}}}}'
"my-app" patched
After further investigation and a glance through RFC 6902, it looks like it was a request body schema that was the problem. Seems like a) it needs to be a json array and b) needs to include the "op", "path" and "value" keys following the RFC spec.
Here's a working request to patch a buildconfig:
PATCH /oapi/v1/namespaces/myProject/buildconfigs/myBuild Content-Type application/json-patch+json Accept application/json Body
[
{
"op": "replace",
"path": "/spec/output/to/name",
"value": "myregistry.example.com/myapp:latest-1"
}
]
Could we add this in the OpenShift REST API documentation somewhere? GET, POST, PUT and DELETE should be straight-forward for most users as is. However, the PATCH is less straight forward in the docs (see https://docs.openshift.com/container-platform/3.5/rest_api/openshift_v1.html#unversioned-patch) and does not really give any clue as to how to properly format the request.
/assign @liggitt
It would be immensely helpful to mention this bug/requirement in the Kubernetes API reference.
sorry... Wrong project
Issues go stale after 90d of inactivity.
Mark the issue as fresh by commenting /remove-lifecycle stale
.
Stale issues rot after an additional 30d of inactivity and eventually close.
Exclude this issue from closing by commenting /lifecycle frozen
.
If this issue is safe to close now please do so with /close
.
/lifecycle stale
Stale issues rot after 30d of inactivity.
Mark the issue as fresh by commenting /remove-lifecycle rotten
.
Rotten issues close after an additional 30d of inactivity.
Exclude this issue from closing by commenting /lifecycle frozen
.
If this issue is safe to close now please do so with /close
.
/lifecycle rotten /remove-lifecycle stale
Rotten issues close after 30d of inactivity.
Reopen the issue by commenting /reopen
.
Mark the issue as fresh by commenting /remove-lifecycle rotten
.
Exclude this issue from closing again by commenting /lifecycle frozen
.
/close
Executing the following REST API call results in a 415, despite using a supposedly supported content type. Executing the same call using a known unsupported media type (such as
text/plain
) returns a expected 406 with list of valid content types that still result in a 415:PATCH /oapi/v1/namespaces/myNamespace/deploymentconfigs/myDeploy Content-Type: application/json Accept: application/json Body:
PATCH /oapi/v1/namespaces/myNamespace/deploymentconfigs/myDeploy Content-Type: text/plain Accept: text/plain Body "some junk that should return an error"
Response:
Version
Steps To Reproduce
application/json
.Current Result
Response 415 Body
Expected Result
PATCH request returns 2xx response code and the resource is patched with the changed data.