Skip to content

Commit

Permalink
Do not delete pods and let stateful sets handle restarts (#153)
Browse files Browse the repository at this point in the history
With the right timeout setting (part of PR #152)
there is no need to restart pods part of the old zone manually as all pods get restarted.
  • Loading branch information
kerneltime authored Jun 30, 2020
1 parent d6fcdca commit 92c04ff
Showing 1 changed file with 0 additions and 8 deletions.
8 changes: 0 additions & 8 deletions pkg/controller/cluster/main-controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ import (
"crypto/sha256"
"encoding/hex"
"fmt"
"strconv"
"time"

"k8s.io/klog"
Expand Down Expand Up @@ -469,7 +468,6 @@ 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()
mi, err = c.updateMinIOInstanceStatus(ctx, mi, addingZone, 0)
if err != nil {
return err
Expand All @@ -496,12 +494,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 92c04ff

Please sign in to comment.