Skip to content

Commit

Permalink
Fix a bug where StatefulSets continued to update forever (#1702)
Browse files Browse the repository at this point in the history
* Fix a bug where StatefulSets continued to update forever

---------

Co-authored-by: jiuker <2818723467@qq.com>
  • Loading branch information
chitoku-k and jiuker committed Jul 31, 2023
1 parent eb8793a commit 51f521e
Showing 1 changed file with 0 additions and 19 deletions.
19 changes: 0 additions & 19 deletions pkg/resources/statefulsets/minio-statefulset.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ import (
v1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime/schema"
"k8s.io/apimachinery/pkg/util/intstr"
)

const (
Expand Down Expand Up @@ -817,29 +816,11 @@ func NewPool(args *NewPoolArgs) *appsv1.StatefulSet {
podVolumes = append(podVolumes, t.Spec.SideCars.Volumes...)
}

moreServers := pool.Servers > 4
unavailable := intstr.FromInt(1)
if moreServers {
// if we have more servers than 4 nodes in a statefulset,
// we can allow rolling update strategy to roll two pods
// at a time instead of just '1' (default), MinIO servers
// beyond 4 servers are capable of tolerating a minimum
// of 2 replicas being down - this allows for faster
// rolling update strategy for all our deployments.
unavailable = intstr.FromInt(2)
}

initContainer := getInitContainer(t, operatorImage, pool)

ss := &appsv1.StatefulSet{
ObjectMeta: ssMeta,
Spec: appsv1.StatefulSetSpec{
UpdateStrategy: appsv1.StatefulSetUpdateStrategy{
Type: miniov2.DefaultUpdateStrategy,
RollingUpdate: &appsv1.RollingUpdateStatefulSetStrategy{
MaxUnavailable: &unavailable,
},
},
PodManagementPolicy: t.Spec.PodManagementPolicy,
Selector: ContainerMatchLabels(t, pool),
ServiceName: serviceName,
Expand Down

0 comments on commit 51f521e

Please sign in to comment.