v4.2/kube1.14 `oc edit` failed with error "415 Unsupported Media Type" for media types is "strategic-merge-patch+json" Client Version: version.Info{Major:"4", Minor:"1+", GitVersion:"v4.1.0+70479e3-461-dirty", GitCommit:"70479e3", GitTreeState:"dirty", BuildDate:"2019-06-03T12:54:36Z", GoVersion:"go1.12.5", Compiler:"gc", Platform:"linux/amd64"} Server Version: version.Info{Major:"1", Minor:"13+", GitVersion:"v1.13.4+f17f435", GitCommit:"f17f435", GitTreeState:"clean", BuildDate:"2019-06-05T22:25:38Z", GoVersion:"go1.11.5", Compiler:"gc", Platform:"linux/amd64"} How reproducible: 100% Steps to Reproduce: 1.configure upgrade repo to `baseurl=http://download.eng.bos.redhat.com/rcm-guest/puddles/RHAOS/AtomicOpenShift/4.2/2019-06-06.1/x86_64/os/` 2. update openshift-clients with `sudo dnf update openshift-clients` 3.`oc edit servicecatalogapiserver` to change "managementState" from "Managed" to "Removed"; Actual Result: 1. cat /etc/yum.repos.d/OCP41.repo [OCP41] name=OCP41 baseurl=http://download.eng.bos.redhat.com/rcm-guest/puddles/RHAOS/AtomicOpenShift/4.2/2019-06-06.1/x86_64/os/ enabled=1 gpgcheck=0 2.sudo dnf update openshift-clients Downloading Packages: openshift-clients-4.1.1-201906051627.git.0.4b47d33.el7.x86_64.rpm 980 kB/s | 16 MB 00:17 -------------------------------------------------------------------------------------------------------------------------------------------------------------------- Total 980 kB/s | 16 MB 00:17 Running transaction check Transaction check succeeded. Running transaction test Transaction test succeeded. Running transaction Preparing : 1/1 Upgrading : openshift-clients-4.1.1-201906051627.git.0.4b47d33.el7.x86_64 1/2 Cleanup : openshift-clients-4.1.0-201905032232.git.0.73d5474.el7.x86_64 2/2 Running scriptlet: openshift-clients-4.1.0-201905032232.git.0.73d5474.el7.x86_64 2/2 Verifying : openshift-clients-4.1.1-201906051627.git.0.4b47d33.el7.x86_64 1/2 Verifying : openshift-clients-4.1.0-201905032232.git.0.73d5474.el7.x86_64 2/2 Upgraded: openshift-clients-4.1.1-201906051627.git.0.4b47d33.el7.x86_64 Complete! 3. oc edit servicecatalogapiserver error: servicecatalogapiservers.operator.openshift.io "cluster" could not be patched: the body of the request was in an unknown format - accepted media types include: application/json-patch+json, application/merge-patch+json You can run `oc replace -f /tmp/oc-edit-wnefp.yaml` to try this update again 4.oc edit servicecatalogcontrollermanagers cluster --loglevel=9 I0610 16:46:25.586805 26093 loader.go:359] Config loaded from file /home/chuo/.kube/config I0610 16:46:25.593439 26093 round_trippers.go:419] curl -k -v -XGET -H "Accept: application/json" -H "User-Agent: oc/v1.14.0+70479e3 (linux/amd64) kubernetes/70479e3" 'https://api.qe-chuo0610.qe.devcluster.openshift.com:6443/apis/operator.openshift.io/v1/servicecatalogcontrollermanagers/cluster' I0610 16:46:26.589395 26093 round_trippers.go:438] GET https://api.qe-chuo0610.qe.devcluster.openshift.com:6443/apis/operator.openshift.io/v1/servicecatalogcontrollermanagers/cluster 200 OK in 995 milliseconds I0610 16:46:26.589521 26093 round_trippers.go:444] Response Headers: I0610 16:46:26.589541 26093 round_trippers.go:447] Date: Mon, 10 Jun 2019 08:46:26 GMT I0610 16:46:26.589620 26093 round_trippers.go:447] Audit-Id: 6501c7ff-681a-4e11-ab9b-f92ab8aa9675 I0610 16:46:26.589636 26093 round_trippers.go:447] Cache-Control: no-store I0610 16:46:26.589652 26093 round_trippers.go:447] Content-Type: application/json I0610 16:46:26.589666 26093 round_trippers.go:447] Content-Length: 1024 I0610 16:46:26.589734 26093 request.go:942] Response Body: {"apiVersion":"operator.openshift.io/v1","kind":"ServiceCatalogControllerManager","metadata":{"creationTimestamp":"2019-06-10T01:22:24Z","generation":4,"name":"cluster","resourceVersion":"83564","selfLink":"/apis/operator.openshift.io/v1/servicecatalogcontrollermanagers/cluster","uid":"33d3f8b4-8b1e-11e9-a5fa-021fa23aaa28"},"spec":{"logLevel":"Normal","managementState":"Managed"},"status":{"conditions":[{"lastTransitionTime":"2019-06-10T05:52:07Z","status":"True","type":"Available"},{"lastTransitionTime":"2019-06-10T05:51:12Z","status":"False","type":"Progressing"},{"lastTransitionTime":"2019-06-10T01:22:24Z","reason":"Removed","status":"False","type":"Degraded"},{"lastTransitionTime":"2019-06-10T01:52:56Z","status":"False","type":"WorkloadDegraded"}],"generations":[{"group":"apps","hash":"","lastGeneration":2,"name":"controller-manager","namespace":"openshift-service-catalog-controller-manager","resource":"daemonsets"}],"observedGeneration":4,"readyReplicas":0,"version":"4.1.0-0.nightly-2019-06-06-160120"}} I0610 16:46:26.591524 26093 editor.go:128] Opening file with editor [vi /tmp/oc-edit-lx9ec.yaml] I0610 16:46:36.122550 26093 editoptions.go:290] User edited: # Please edit the object below. Lines beginning with a '#' will be ignored, # and an empty file will abort the edit. If an error occurs while saving this file will be # reopened with the relevant failures. # apiVersion: operator.openshift.io/v1 kind: ServiceCatalogControllerManager metadata: creationTimestamp: "2019-06-10T01:22:24Z" generation: 4 name: cluster resourceVersion: "83564" selfLink: /apis/operator.openshift.io/v1/servicecatalogcontrollermanagers/cluster uid: 33d3f8b4-8b1e-11e9-a5fa-021fa23aaa28 spec: logLevel: Normal managementState: Removed status: conditions: - lastTransitionTime: "2019-06-10T05:52:07Z" status: "True" type: Available - lastTransitionTime: "2019-06-10T05:51:12Z" status: "False" type: Progressing - lastTransitionTime: "2019-06-10T01:22:24Z" reason: Removed status: "False" type: Degraded - lastTransitionTime: "2019-06-10T01:52:56Z" status: "False" type: WorkloadDegraded generations: - group: apps hash: "" lastGeneration: 2 name: controller-manager namespace: openshift-service-catalog-controller-manager resource: daemonsets observedGeneration: 4 readyReplicas: 0 version: 4.1.0-0.nightly-2019-06-06-160120 I0610 16:46:36.130101 26093 request.go:942] Request Body: {"spec":{"managementState":"Removed"}} I0610 16:46:36.130151 26093 round_trippers.go:419] curl -k -v -XPATCH -H "Accept: application/json" -H "Content-Type: application/strategic-merge-patch+json" -H "User-Agent: oc/v1.14.0+70479e3 (linux/amd64) kubernetes/70479e3" 'https://api.qe-chuo0610.qe.devcluster.openshift.com:6443/apis/operator.openshift.io/v1/servicecatalogcontrollermanagers/cluster' I0610 16:46:36.375814 26093 round_trippers.go:438] PATCH https://api.qe-chuo0610.qe.devcluster.openshift.com:6443/apis/operator.openshift.io/v1/servicecatalogcontrollermanagers/cluster 415 Unsupported Media Type in 245 milliseconds I0610 16:46:36.375868 26093 round_trippers.go:444] Response Headers: I0610 16:46:36.375890 26093 round_trippers.go:447] Content-Length: 263 I0610 16:46:36.375912 26093 round_trippers.go:447] Date: Mon, 10 Jun 2019 08:46:36 GMT I0610 16:46:36.375934 26093 round_trippers.go:447] Audit-Id: d0fcc71c-8270-48b7-bac9-075cba51b32b I0610 16:46:36.375956 26093 round_trippers.go:447] Cache-Control: no-store I0610 16:46:36.375977 26093 round_trippers.go:447] Content-Type: application/json I0610 16:46:36.376042 26093 request.go:942] Response Body: {"kind":"Status","apiVersion":"v1","metadata":{},"status":"Failure","message":"the body of the request was in an unknown format - accepted media types include: application/json-patch+json, application/merge-patch+json","reason":"UnsupportedMediaType","code":415} error: servicecatalogcontrollermanagers.operator.openshift.io "cluster" could not be patched: the body of the request was in an unknown format - accepted media types include: application/json-patch+json, application/merge-patch+json You can run `oc replace -f /tmp/oc-edit-lx9ec.yaml` to try this update again. F0610 16:46:36.376767 26093 helpers.go:114] Expect Result: oc edit servicecatalogapiserver servicecatalogcontrollermanager.operator.openshift.io/cluster edited
Can you please double check that against 4.1 and 4.2 clusters, it looks like only 4.1 is having this issue, iow. we might be missing some patch there. I've tried 4.1 and 4.2 clients and they both worked fine passing application/merge-patch+json as content type, so it looks like we might be missing something on the server. And I clearly see you're using 4.1 cluster: Server Version: version.Info{Major:"1", Minor:"13+", GitVersion:"v1.13.4+f17f435", GitCommit:"f17f435", GitTreeState:"clean", BuildDate:"2019-06-05T22:25:38Z", GoVersion:"go1.11.5", Compiler:"gc", Platform:"linux/amd64"}
OK, I've put my hands on 4.1 server, specifically: Server Version: version.Info{Major:"1", Minor:"13+", GitVersion:"v1.13.4+f8a0834", GitCommit:"f8a0834", GitTreeState:"clean", BuildDate:"2019-06-12T05:36:57Z", GoVersion:"go1.11.9", Compiler:"gc", Platform:"linux/amd64"} and that worked fine, please double check with newer server version.
Since the problem described in this bug report should be resolved in a recent advisory, it has been closed with a resolution of ERRATA. For information on the advisory, and where to find the updated files, follow the link below. If the solution does not work for you, open a new bug report. https://access.redhat.com/errata/RHBA-2020:2023