Skip to content

Conversation

@djkonro
Copy link
Contributor

@djkonro djkonro commented Jun 19, 2017

No description provided.

@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Jun 19, 2017
@mbohlool mbohlool requested a review from sebgoa June 21, 2017 06:25
@djkonro
Copy link
Contributor Author

djkonro commented Jun 25, 2017

@mbohlool, I am trying to use replace_namespaced_pod(...), but when I execute the following lines

pod.spec.containers[0].image = 'busybox:1.26.1'
v1.replace_namespaced_pod(name=name, namespace="default", body=pod)

I get the error

kubernetes.client.rest.ApiException: (422)
Reason: Unprocessable Entity
HTTP response headers: HTTPHeaderDict({'Date': 'Sun, 25 Jun 2017 16:11:17 GMT', 'Content-Length': '604', 'Content-Type': 'application/json'}) HTTP response body: {"kind":"Status","apiVersion":"v1","metadata":{},"status":"Failure","message":"Pod \"busybox\" is invalid: spec: Forbidden: pod updates may not change fields other than containers[].image or spec.activeDeadlineSeconds or spec.tolerations (only additions to existing tolerations)","reason":"Invalid","details":{"name":"busybox","kind":"Pod","causes": [{"reason":"FieldValueForbidden","message":"Forbidden: pod updates may not change fields other than containers[].imageorspec.activeDeadlineSecondsorspec.tolerations (only additions to existing tolerations)","field":"spec"}]},"code":422}

From code, the only change I have made is to containers[*].image
https://gist.github.com/djkonro/1b46f583107311ef3a144759ec26180f#file-intro_notebook-py-L64

@mbohlool
Copy link
Contributor

That look like a usecase for "patch" not "replace". Have you tried that?

@djkonro
Copy link
Contributor Author

djkonro commented Jun 28, 2017

@mbohlool I was just trying to see how the "replace" command works with various object. I tried "patch" and it works fine for pods, and the "replace" command also works fine with ReplicationControllers and Deployments.

Copy link
Contributor

@sebgoa sebgoa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this good, no real need to show the replace here.

@mbohlool
Copy link
Contributor

mbohlool commented Jul 5, 2017

Please apply LGTM label to any PR that is ready to merge (also make sure the branch is up to date).

@sebgoa
Copy link
Contributor

sebgoa commented Jul 7, 2017

/lgtm

@mbohlool I don't think I have privs to add labels

@mbohlool mbohlool merged commit 1471c6d into kubernetes-client:master Jul 7, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cncf-cla: yes Indicates the PR's author has signed the CNCF CLA.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants