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

Updating statefulset from v1beta1 to v1beta2 #56806

Closed
ryanmcnamara opened this issue Dec 4, 2017 · 7 comments
Closed

Updating statefulset from v1beta1 to v1beta2 #56806

ryanmcnamara opened this issue Dec 4, 2017 · 7 comments
Labels
kind/bug Categorizes issue or PR as related to a bug. sig/apps Categorizes an issue or PR as relevant to SIG Apps.

Comments

@ryanmcnamara
Copy link

ryanmcnamara commented Dec 4, 2017

Is this a BUG REPORT or FEATURE REQUEST?:

/kind bug

I have a stateful set that I created with api version v1beta1, I'm trying to update it to add a new annotation in the pod template using the v1beta2 api version in the update request but the update does not roll the pod. It seems that updating pods of stateful sets only works if it was initially created at version v1beta2, which I believe is a bug.

See
https://gist.github.com/ryanmcnamara/55c1327754b9fbc4518f2334f4e184b0
I did

kubectl apply -f v1beta1.yml
# wait for running pod
kubectl apply -f v1beta2.yml # has api version v1beta2
# observe no change in pod, probably expected
kubectl apply -f v1beta2_updated.yml # has a new annotation
# Existing pod is not rolled, unexpected

However (after deleting the statefulset)

kubectl apply -f v1beta2.yml
# Wait for running pod
kubectl apply -f v1beta2_updated.yml
# Pod is rolled as expected
  • Kubernetes version (use kubectl version):
    version:
$ kubectl version
Client Version: version.Info{Major:"1", Minor:"8+", GitCommit:"f18e43226af9f1c38a7cbeba0045baf435a125d7", GitTreeState:"clean", BuildDate:"2017-11-17T17:36:31Z", GoVersion:"go1.8.3", Compiler:"gc", Platform:"linux/amd64"}
Server Version: version.Info{Major:"1", Minor:"8+", GitCommit:"f18e43226af9f1c38a7cbeba0045baf435a125d7", GitTreeState:"clean", BuildDate:"2017-11-17T17:34:14Z", GoVersion:"go1.8.3", Compiler:"gc", Platform:"linux/amd64"}
@k8s-ci-robot k8s-ci-robot added the kind/bug Categorizes issue or PR as related to a bug. label Dec 4, 2017
@k8s-github-robot k8s-github-robot added the needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. label Dec 4, 2017
@dims
Copy link
Member

dims commented Dec 4, 2017

/sig api-machinery

@k8s-ci-robot k8s-ci-robot added the sig/api-machinery Categorizes an issue or PR as relevant to SIG API Machinery. label Dec 4, 2017
@k8s-github-robot k8s-github-robot removed the needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. label Dec 4, 2017
@yliaog
Copy link
Contributor

yliaog commented Dec 7, 2017

/sig apps

@k8s-ci-robot k8s-ci-robot added the sig/apps Categorizes an issue or PR as relevant to SIG Apps. label Dec 7, 2017
@roycaihw
Copy link
Member

roycaihw commented Dec 7, 2017

/remove-sig api-machinery

@k8s-ci-robot k8s-ci-robot removed the sig/api-machinery Categorizes an issue or PR as relevant to SIG API Machinery. label Dec 7, 2017
@danielqsj
Copy link
Contributor

@ryanmcnamara
Because the default spec.updateStrategy for the StatefulSet kinds is OnDelete.
If you want to roll update, you should change spec.updateStrategy to RollingUpdate.

@ryanmcnamara
Copy link
Author

@danielqsj
Hmm I'm getting some conflicting docs about this
https://github.com/kubernetes/kubernetes/blob/master/staging/src/k8s.io/api/apps/v1beta2/types.go#L126
states that the default is RollingUpdate
While https://kubernetes.io/docs/concepts/workloads/controllers/statefulset/#update-strategies states the default is OnDelete

At any rate it appears the default really is RollingUpdate, because my second test

kubectl apply -f v1beta2.yml
# Wait for running pod
kubectl apply -f v1beta2_updated.yml
# Pod is rolled as expected

Actually does roll the pod.

It appears that

kubectl apply -f v1beta2.yml

and

kubectl apply -f v1beta1.yml
kubectl apply -f v1beta2.yml

end up storing different objects in k8s, which doesn't make sense to me

@danielqsj
Copy link
Contributor

@ryanmcnamara
Sorry my previous comment is incomplete.
What I mean is the default spec.updateStrategy for the StatefulSet v1beta1 kinds is OnDelete.
You could find it in 1.8 release note.

The default spec.updateStrategy for the StatefulSet and DaemonSet kinds is RollingUpdate for the apps/v1beta2 group version. You can explicitly set the OnDelete strategy, and no strategy auto-conversion is applied to replace default values.

@danielqsj
Copy link
Contributor

@ryanmcnamara
Code is here:
v1beta1:

obj.Spec.UpdateStrategy.Type = appsv1beta1.OnDeleteStatefulSetStrategyType

v1beta2:
obj.Spec.UpdateStrategy.Type = appsv1beta2.RollingUpdateStatefulSetStrategyType

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Categorizes issue or PR as related to a bug. sig/apps Categorizes an issue or PR as relevant to SIG Apps.
Projects
None yet
Development

No branches or pull requests

7 participants