@@ -522,7 +522,8 @@ func (c *M3DBController) handleClusterUpdate(cluster *myspec.M3DBCluster) error
522522
523523 replicas := * sts .Spec .Replicas
524524 ready := replicas == sts .Status .ReadyReplicas
525- if sts .Status .UpdateRevision != "" {
525+ if sts .Status .UpdateRevision != "" &&
526+ sts .Spec .UpdateStrategy .Type == appsv1 .RollingUpdateStatefulSetStrategyType {
526527 // If there is an update revision, ensure all pods are updated
527528 // otherwise there is a rollout in progress.
528529 // Note: This ensures there is no race condition between
@@ -537,6 +538,7 @@ func (c *M3DBController) handleClusterUpdate(cluster *myspec.M3DBCluster) error
537538
538539 if ! ready {
539540 c .logger .Info ("waiting for statefulset to be ready" ,
541+ zap .String ("namespace" , sts .Namespace ),
540542 zap .String ("name" , sts .Name ),
541543 zap .Int32 ("replicas" , replicas ),
542544 zap .Int32 ("readyReplicas" , sts .Status .ReadyReplicas ),
@@ -565,21 +567,19 @@ func (c *M3DBController) handleClusterUpdate(cluster *myspec.M3DBCluster) error
565567 // strategy, then move to the next statefulset. When using the OnDelete update
566568 // strategy, we still may want to restart nodes for this particular statefulset,
567569 // so don't continue yet.
568- if ! update && ! cluster .Spec .OnDeleteUpdateStrategy {
570+ onDeleteUpdateStrategy :=
571+ actual .Spec .UpdateStrategy .Type == appsv1 .OnDeleteStatefulSetStrategyType
572+ if ! update && ! onDeleteUpdateStrategy {
569573 continue
570574 }
571575
572576 if update {
573- actual , err = c .applyStatefulSetUpdate (cluster , actual , expected )
577+ _ , err = c .applyStatefulSetUpdate (cluster , actual , expected )
574578 if err != nil {
575579 c .logger .Error (err .Error ())
576580 return err
577581 }
578- // If using a RollingUpdate strategy, do not process the next statefulset.
579- // We must wait for the kube controller to update the pods.
580- if ! cluster .Spec .OnDeleteUpdateStrategy {
581- return nil
582- }
582+ return nil
583583 }
584584
585585 // Using an OnDelete strategy, we have to update nodes if:
@@ -589,8 +589,8 @@ func (c *M3DBController) handleClusterUpdate(cluster *myspec.M3DBCluster) error
589589 // Therefore, always check to see if pods need to be updated and return from this loop
590590 // if the statefulset or pods were updated. If a rollout is finished or there has not
591591 // been a change, this call is a no-op.
592- if cluster . Spec . OnDeleteUpdateStrategy {
593- nodesUpdated , err := c .updateStatefulSetNodes (cluster , actual )
592+ if onDeleteUpdateStrategy {
593+ nodesUpdated , err := c .updateStatefulSetPods (cluster , actual )
594594 if err != nil {
595595 c .logger .Error ("error performing update" ,
596596 zap .Error (err ),
@@ -601,7 +601,7 @@ func (c *M3DBController) handleClusterUpdate(cluster *myspec.M3DBCluster) error
601601
602602 // If we've performed any updates at all, do not process the next statefulset.
603603 // Wait for the updated pods to become healthy.
604- if update || nodesUpdated {
604+ if nodesUpdated {
605605 return nil
606606 }
607607 }
@@ -826,8 +826,8 @@ func (c *M3DBController) applyStatefulSetUpdate(
826826 return updated , nil
827827}
828828
829- // updateStatefulSetNodes returns true if it updates any pods
830- func (c * M3DBController ) updateStatefulSetNodes (
829+ // updateStatefulSetPods returns true if it updates any pods
830+ func (c * M3DBController ) updateStatefulSetPods (
831831 cluster * myspec.M3DBCluster ,
832832 sts * appsv1.StatefulSet ,
833833) (bool , error ) {
@@ -1325,6 +1325,7 @@ func copyAnnotations(expected, actual *appsv1.StatefulSet) {
13251325 // updates.
13261326 if k == annotations .ParallelUpdate {
13271327 expected .Annotations [annotations .ParallelUpdateInProgress ] = v
1328+ continue
13281329 }
13291330
13301331 if _ , ok := expected .Annotations [k ]; ! ok {
0 commit comments