Skip to content

Commit

Permalink
Do not delete pods and let stateful sets handle restarts
Browse files Browse the repository at this point in the history
With the right timeout setting (part of PR minio#152)
there is no need to restart pods part of the old zone manually as all pods get restarted.

Signed-off-by: Ritesh H Shukla <ritesh@minio.io>
  • Loading branch information
Ritesh H Shukla committed Jun 22, 2020
1 parent 4810731 commit 9705766
Showing 1 changed file with 1 addition and 8 deletions.
9 changes: 1 addition & 8 deletions pkg/controller/cluster/main-controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ package cluster
import (
"context"
"fmt"
"strconv"
"time"

"k8s.io/klog"
Expand Down Expand Up @@ -458,7 +457,7 @@ func (c *Controller) syncHandler(key string) error {
if mi.MinIOReplicas() != *ss.Spec.Replicas && mi.Status.CurrentState != addingZone {
// save current replicas before creating new statefulset
// this is used later to delete only the older pods in statefulset
currentReplicas := mi.MinIOReplicas()
//currentReplicas := mi.MinIOReplicas()
mi, err = c.updateMinIOInstanceStatus(ctx, mi, addingZone, 0)
if err != nil {
return err
Expand All @@ -485,12 +484,6 @@ func (c *Controller) syncHandler(key string) error {
if _, err := c.kubeClientSet.AppsV1().StatefulSets(mi.Namespace).Update(ctx, ss, uOpts); err != nil {
return err
}
// remove all the existing Pods so StatefulSet creates new pods with proper secrets/cli args etc
for i := 0; i < int(currentReplicas); i++ {
if err := c.kubeClientSet.CoreV1().Pods(mi.Namespace).Delete(ctx, "minio-"+strconv.Itoa(i), metav1.DeleteOptions{}); err != nil {
return err
}
}
}

// If this container version on the MinIOInstance resource is specified, and the
Expand Down

0 comments on commit 9705766

Please sign in to comment.