Skip to content

Commit

Permalink
adjust the judgment logic of whether the current ordinal needs to be …
Browse files Browse the repository at this point in the history
…updated (#1751)

* adjust the judgment logic of whether the current ordinal needs to be updated

Signed-off-by: zhangyubin <[email protected]>

* add more ut cases and description about isCurrentRevisionNeeded(create pod with current revision or updated)

Signed-off-by: Abner-1 <[email protected]>

---------

Signed-off-by: zhangyubin <[email protected]>
Signed-off-by: Abner-1 <[email protected]>
Co-authored-by: zhangyubin <[email protected]>
Co-authored-by: Abner-1 <[email protected]>
  • Loading branch information
3 people authored Oct 12, 2024
1 parent c5f751a commit 0964df6
Show file tree
Hide file tree
Showing 2 changed files with 815 additions and 4 deletions.
8 changes: 4 additions & 4 deletions pkg/controller/statefulset/stateful_set_utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -511,15 +511,15 @@ func isCurrentRevisionNeeded(set *appsv1beta1.StatefulSet, updateRevision string
return false
}
if set.Spec.UpdateStrategy.RollingUpdate == nil {
return ordinal < int(set.Status.CurrentReplicas)
return ordinal < getStartOrdinal(set)+int(set.Status.CurrentReplicas)
}
if set.Spec.UpdateStrategy.RollingUpdate.UnorderedUpdate == nil {
return ordinal < int(*set.Spec.UpdateStrategy.RollingUpdate.Partition)
return ordinal < getStartOrdinal(set)+int(*set.Spec.UpdateStrategy.RollingUpdate.Partition)
}

var noUpdatedReplicas int
for i, pod := range replicas {
if pod == nil || i == ordinal {
for _, pod := range replicas {
if pod == nil || getOrdinal(pod) == ordinal {
continue
}
if !revision.IsPodUpdate(pod, updateRevision) {
Expand Down
Loading

0 comments on commit 0964df6

Please sign in to comment.