-
Notifications
You must be signed in to change notification settings - Fork 3.3k
patch_namespaced_deployment gets 500 as response when using json-patch #187
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
Comments
patch should be an object not an array of objects. patch = {"op": "replace", "value": "nginx:1.11.13", "path": "/spec/template/spec/containers/0/image"} |
as the RFC states it is a list of objects
if you mean that the api responses with a 200, when you patch just an object, yes you're right, but the patch is not applied. if you comment out lines 157 and 158 (on master) in kubernetes/client/rest.py it works again. So the content-type in this case is wrong. the following lines breaks the patch in this case.
|
@mbohlool : ack, i'll try to find a way to multiple ways to specify the patch request body |
body = client.V1beta1Deployment(api_version='extensions/v1beta1', kind='Deployment',
metadata=metadata, spec=spec, status=status)
# call API
try:
ext_v1_client.patch_namespaced_deployment(name=deployment_name, namespace=deployment_namespace, body=body, pretty='true')
except ApiException as e:
|
fix for #187 failure when using RFC 6902 json-patch operation
I think this is fixed? please re-open if it is not fixed. |
@aosterkamp If I would like to update multiple values from your above example |
@chlung sorry for the late reply. your first example is correct. The second one should not work as far as the RFC goes, but I haven't tested it. |
@aosterkamp thanks |
@mbohlool Does the issue fixed? I faced the same issue. Could you help have a look at my case?
The output as below:
If I set the replicas as |
I would run |
@mbohlool I made a plan b to scale deployment, which as below:
|
Be very careful about |
@mbohlool Ok, look forward to your PR. Thanks! |
I don't think a PR here helps. What I am suggesting is to fix your problem, you can change the format of the patch to match what server expect. Other users of the client already figured that out and by searching into the issues, you can find your solution. Good luck and let me know if you need any help there. |
The patch object doesn't work at all, the following code is wrong
@DjangoPeng Yours method is right |
…-unavailable Prevent 503s from killing the client during discovery
When using a RFC6902 formatted json-patch you get a 500 response.
The hack for the issue #93 introduced this bug.
Are there any plans to get rid of the hack?
To repoduce the problem the following can be done:
create the deployment with kubectl
try to patch it
log output
The text was updated successfully, but these errors were encountered: