-
Notifications
You must be signed in to change notification settings - Fork 509
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
Add an example of how to use patch. #450
Comments
Just to make sure I understand this before looking into doing an example. Lets take the example from #443 (comment) const k8sNetworkingApi = kc.makeApiClient(k8s.NetworkingV1beta1Api);
const patchedIngress = {
metadata: {
annotations: {
'nginx.ingress.kubernetes.io/cors-allow-origin': '*'
}
}
}
// The following gets rejected with a
// "Unsupported Media Type":
// the body of the request was in an unknown format -
// accepted media types include: application/json-patch+json,
// application/merge-patch+json, application/apply-patch+yaml
k8sNetworkingApi.patchNamespacedIngress(ingressName, namespace, patchedIngress);
// The fix is to do this:
k8sNetworkingApi.patchNamespacedIngress(ingressName, namespace, patchedIngress, undefined, undefined, undefined, undefined,
{ headers: { 'content-type': 'application/merge-patch+json' } }); The problems boils down to this (again, as I understand it).
So, in other words: the generated client code that does the |
@danquah Exactly. That is why I asked for the example - client code does not work out of the box, optional parameter which specifies content-type must be included. In my opinion it is fine to force developers to specify this explicitly - in my case it lead me to study various merge types in Kubernetes (https://www.disasterproject.com/kubernetes-kubectl-patching/). But it should be documented. |
@brendanburns Same here, I am not able to patch a container image. It works just fine when I run it from postman: It looks like we are suffering the same issue of kubernetes-client/python#866 |
See #443 (comment)
The text was updated successfully, but these errors were encountered: