I noticed that most patch calls support all 3 patch types (json-patch, merge-patch, strategic-merge-patch), but the patch calls for custom objects (including for status and scale sub-resources) only support merge-patch.
For example compare consumes for the custom object from the swagger.json file:
"patch": {
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "object"
}
},
"401": {
"description": "Unauthorized"
}
},
"schemes": [
"https"
],
"description": "patch the specified cluster scoped custom object",
"parameters": [
{
"schema": {
"type": "object"
},
"description": "The JSON schema of the Resource to patch.",
"required": true,
"name": "body",
"in": "body"
}
],
"produces": [
"application/json"
],
"x-codegen-request-body-name": "body",
"tags": [
"custom_objects"
],
"consumes": [
"application/merge-patch+json"
],
"operationId": "patchClusterCustomObject"
},
and consumes from Pod:
"patch": {
"description": "partially update the specified Pod",
"consumes": [
"application/json-patch+json",
"application/merge-patch+json",
"application/strategic-merge-patch+json"
],
"produces": [
"application/json",
"application/yaml",
"application/vnd.kubernetes.protobuf"
],
...
This then prevents using json-patch instead of merge-patch. Kubectl handles it.
The code in rest.py then have some strange things since it actually use the first one only and then if a json-patch contenttype but not list switch to merge-patch. So would be good to have json-patch+json first also for custom objects.
I noticed that most patch calls support all 3 patch types (json-patch, merge-patch, strategic-merge-patch), but the patch calls for custom objects (including for status and scale sub-resources) only support merge-patch.
For example compare
consumesfor the custom object from the swagger.json file:and
consumesfrom Pod:This then prevents using json-patch instead of merge-patch. Kubectl handles it.
The code in
rest.pythen have some strange things since it actually use the first one only and then if a json-patch contenttype but not list switch to merge-patch. So would be good to have json-patch+json first also for custom objects.