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

[BUG] When 'ordinals' are set, the 'pratition' behaves differently during updates and deleting #1749

Open
karlhjm opened this issue Sep 14, 2024 · 2 comments
Assignees
Labels
kind/bug Something isn't working

Comments

@karlhjm
Copy link

karlhjm commented Sep 14, 2024

What happened:

After declaring the ordinal index, confusion occurred in the logical index recognition of pods when updating, scaling, or deleting pods with partition.
eg. with rollingUpdate, when ordinal index=2, updating partition from 5 to 3, pod-3 still use old template, but pod-3 uses new template when recreating it.

What you expected to happen:
In the above example, p3 should use old template, because of ordinals=2, the logic idx of p3 should be 3-2=1, which is smaller than partition=3

How to reproduce it (as minimally and precisely as possible):

ordinals=2, replicas=5, partition=7, old pods [p2, p3, p4, p5, p6]
update sts template and change partition=5
nothing happend, old pods [p2, p3, p4, p5, p6]
update partition=3, sts updates automatically, old pods [p2, p3, p4], new pods [p5, p6]
then,
delete p3 then it will be created with new template, old pods [p2, p4], new pods [p3, p5, p6]
delete p4 then it will be created with new template, old pods [p2], new pods [p3, p4, p5, p6]
delete p2 then it will be created with old template, old pods [p2], new pods [p3, p4, p5, p6]

Anything else we need to know?:
Partitioned rolling updates in k8s
https://kubernetes.io/docs/concepts/workloads/controllers/statefulset/#partitions

Environment: ubuntu 16.04

  • Kruise version: 1.7.1
  • Kubernetes version (use kubectl version): 1.20.7
  • Install details (e.g. helm install args):
  • Others:
@karlhjm karlhjm added the kind/bug Something isn't working label Sep 14, 2024
@karlhjm karlhjm changed the title [BUG] When 'ordinals' are set, the 'pratition' behaves differently during updates and scaling operations [BUG] When 'ordinals' are set, the 'pratition' behaves differently during updates and deleting Sep 14, 2024
@ABNER-1 ABNER-1 assigned ABNER-1 and unassigned FillZpp Sep 14, 2024
@ABNER-1
Copy link
Member

ABNER-1 commented Sep 14, 2024

Thank you @karlhjm .
I will test this case later

@ABNER-1
Copy link
Member

ABNER-1 commented Sep 18, 2024

Thank you @karlhjm for your case report.
I have reproduced this case and found that it is caused by

if set.Spec.UpdateStrategy.Type != apps.RollingUpdateStatefulSetStrategyType {
return false
}
if set.Spec.UpdateStrategy.RollingUpdate == nil {
return ordinal < int(set.Status.CurrentReplicas)
}
if set.Spec.UpdateStrategy.RollingUpdate.UnorderedUpdate == nil {
return ordinal < int(*set.Spec.UpdateStrategy.RollingUpdate.Partition)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants