Description of problem: Patching a custom resource as follows always returns an error: $ oc patch prometheusrule/prometheus-k8s-rules -n openshift-monitoring --type=strategic -p '{"metadata": {"annotations": {"cr_patch": "yep"}}}' Error from server (UnsupportedMediaType): the body of the request was in an unknown format - accepted media types include: application/json-patch+json, application/merge-patch+json Running an identical patch against a standard resource works: oc patch node ip-172-31-79-85.us-east-2.compute.internal --type=strategic -p '{"metadata": {"annotations": {"cr_patch": "yep"}}}' node "ip-172-31-79-85.us-east-2.compute.internal" patched Version-Release number of selected component (if applicable): v3.10, v3.11 How reproducible: 100% Steps to Reproduce: 1. oc patch a custom resource definition instance 2. 3. Actual results: An error is reported when an attempt is made to patch a custom resource Expected results: All API resources should be patchable. Additional info:
Created attachment 1477760 [details] loglevel output of patch
From the error message, pls try 'json' or 'merge' patch. Per https://trello.com/c/i86svfMn/973-5-control-plane-custom-resource-definitions#comment-59c130c000115a9d5feda5c6 , 'strategy' is not supported. It may be supported in future.
If it cannot be supported in the short term, an error message indicating the unsupported nature of the default strategy would be helpful.
Update: according to https://github.com/kubernetes/kubernetes/issues/58414, there is no plan to support strategic merge patch for CRD. https://github.com/kubernetes/kubernetes/pull/53558 improved the error message.