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
Error when trying to update StatefulSet updateStrategy.type to "OnDelete" from default value #100151
Comments
/sig api-machinery |
I would like to work on it. |
I tried the first step, however it failed. could you provide the ymal of the first step? @antaloala |
Thanks @lala123912 for jumping
It includes a commented "updateStrategy" stanza you can uncomment to run step2. |
I use Here is the patch file:
then , excute cmd:
describe the sts:
|
/triage accepted |
Thank you @lala123912 for helping here! |
Thanks @lala123912. |
It's not exactly an API server bug... more an unfortunate interaction between server defaulting and client patching. The server is defaulting the In the update step, the client is only sending a patch for the You can make the client explicitly clear the
There's an unimplemented proposal to have the server clear fields corresponding to other types when switching the updateStrategy:
type: OnDelete
rollingUpdate:
partition: 1 |
Thanks a lot @liggitt for so clear explanation |
I am the closing It. |
/close |
@antaloala: Closing this issue. In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
What happened:
When trying to update the .spec.updateStrategy.type of a StatefulSet object to "OnDelete" it fails if it was not previously set (so default value {"type": "RollingUpdate", "rollingUpdate": { "partition": 0} } applies).
Following message is printed by the failing kubectl command:
The StatefulSet "name-of-the-statefulset-object" is invalid: spec.updateStrategy.rollingUpdate: Invalid value: apps.RollingUpdateStatefulSetStrategy{Partition:0}: only allowed for updateStrategy 'RollingUpdate'
What you expected to happen:
To be able to patch the StatefulSet .spec.updateStrategy stanza to {"updateStrategy": "OnDelete"}
How to reproduce it (as minimally and precisely as possible):
Second kubectl command fail printing the error message indicated above
Anything else we need to know?:
If before applying step 2 above I am explictly setting the .spec.updateStrategy stanza to {"type": "RollingUpdate", "rollingUpdate": { "partition": 0} } (i.e. explictly setting the default value) then I can run step 2 above without problem
(note it is not enough to explictly set the .spec.updateStrategy.type to RollingUpdate, it is also needed to set the .spec.updateStrategy.rollingUpdate.partitions to 0 to avoid the step 2 above to fail)
I presume the bug is related to API server still trying to apply part of the default value in the .spec.updateStrategy stanza (i.e. the "rollingUpdate.partition:0" part) even when explictly trying to set ".spec.updateStrategy.type" to "OnDelete", this only happening when default values were added (by API server) to the .spec.updateStrategy stanza of the retrieved object (retrieved in order to try to apply the requested patch).
Environment:
Client Version: version.Info{Major:"1", Minor:"20", GitVersion:"v1.20.1", GitCommit:"c4d752765b3bbac2237bf87cf0b1c2e307844666", GitTreeState:"clean", BuildDate:"2020-12-18T12:09:25Z", GoVersion:"go1.15.5", Compiler:"gc", Platform:"linux/amd64"}
Server Version: version.Info{Major:"1", Minor:"20", GitVersion:"v1.20.1", GitCommit:"c4d752765b3bbac2237bf87cf0b1c2e307844666", GitTreeState:"clean", BuildDate:"2020-12-18T12:00:47Z", GoVersion:"go1.15.5", Compiler:"gc", Platform:"linux/amd64"}
The text was updated successfully, but these errors were encountered: