Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ExtensionsV1beta1Api.patchNamespacedDeployment throws 500 Internal server error because of wrong content type in header #127

Closed
karthikkondapally opened this issue Nov 22, 2017 · 4 comments

Comments

@karthikkondapally
Copy link
Contributor

reason: content-type in header is being set to application/json-patch+json instead of application/strategic-merge-patch+json
this is causing 500 internal server error

when i test the patch call to /apis/extensions/v1beta1/namespaces/default/deployments/kubeexample?pretty=false with content type as application/json-patch+json (in postman rest client) , getting following error

{
    "kind": "Status",
    "apiVersion": "v1",
    "metadata": {},
    "status": "Failure",
    "message": "json: cannot unmarshal object into Go value of type jsonpatch.Patch",
    "code": 500
}

I believe content type should be application/strategic-merge-patch+json (with it as content type deployment gets updated)

in ExtensionsV1beta1Api.patchNamespacedDeploymentCall

localVarContentTypes is being set to application/json-patch+json instead of application/strategic-merge-patch+json because of ApiClient.selectHeaderContentType(String [] arr) always select first element of array({"application/json-patch+json", "application/merge-patch+json", "application/strategic-merge-patch+json"}) as it matches with regex.

@karthikkondapally karthikkondapally changed the title ExtensionsV1beta1Api.patchNamespacedDeployment throws 500 Internal server error because of wrong content type ExtensionsV1beta1Api.patchNamespacedDeployment throws 500 Internal server error because of wrong content type in header Nov 22, 2017
@Rafaesp
Copy link

Rafaesp commented Nov 24, 2017

Same error when calling new NetworkingV1Api().patchNamespacedNetworkPolicy()

@mjschmidt
Copy link

Any word on this issue?

@karthikkondapally
Copy link
Contributor Author

@mjschmidt
with strategic merge patches, it throws internal server error(because of SWAGGER/OPENAPI/codegen related issues). but with Json Patches it will work.
working example of JsonPatch is here https://github.com/kubernetes-client/java/blob/master/examples/src/main/java/io/kubernetes/client/examples/PatchExample.java

@costimuraru
Copy link

How can we use a JsonPatch to patch a Node?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants