@@ -522,7 +522,8 @@ func (c *M3DBController) handleClusterUpdate(cluster *myspec.M3DBCluster) error
522
522
523
523
replicas := * sts .Spec .Replicas
524
524
ready := replicas == sts .Status .ReadyReplicas
525
- if sts .Status .UpdateRevision != "" {
525
+ if sts .Status .UpdateRevision != "" &&
526
+ sts .Spec .UpdateStrategy .Type == appsv1 .RollingUpdateStatefulSetStrategyType {
526
527
// If there is an update revision, ensure all pods are updated
527
528
// otherwise there is a rollout in progress.
528
529
// Note: This ensures there is no race condition between
@@ -537,6 +538,7 @@ func (c *M3DBController) handleClusterUpdate(cluster *myspec.M3DBCluster) error
537
538
538
539
if ! ready {
539
540
c .logger .Info ("waiting for statefulset to be ready" ,
541
+ zap .String ("namespace" , sts .Namespace ),
540
542
zap .String ("name" , sts .Name ),
541
543
zap .Int32 ("replicas" , replicas ),
542
544
zap .Int32 ("readyReplicas" , sts .Status .ReadyReplicas ),
@@ -565,21 +567,19 @@ func (c *M3DBController) handleClusterUpdate(cluster *myspec.M3DBCluster) error
565
567
// strategy, then move to the next statefulset. When using the OnDelete update
566
568
// strategy, we still may want to restart nodes for this particular statefulset,
567
569
// so don't continue yet.
568
- if ! update && ! cluster .Spec .OnDeleteUpdateStrategy {
570
+ onDeleteUpdateStrategy :=
571
+ actual .Spec .UpdateStrategy .Type == appsv1 .OnDeleteStatefulSetStrategyType
572
+ if ! update && ! onDeleteUpdateStrategy {
569
573
continue
570
574
}
571
575
572
576
if update {
573
- actual , err = c .applyStatefulSetUpdate (cluster , actual , expected )
577
+ _ , err = c .applyStatefulSetUpdate (cluster , actual , expected )
574
578
if err != nil {
575
579
c .logger .Error (err .Error ())
576
580
return err
577
581
}
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
583
583
}
584
584
585
585
// Using an OnDelete strategy, we have to update nodes if:
@@ -589,8 +589,8 @@ func (c *M3DBController) handleClusterUpdate(cluster *myspec.M3DBCluster) error
589
589
// Therefore, always check to see if pods need to be updated and return from this loop
590
590
// if the statefulset or pods were updated. If a rollout is finished or there has not
591
591
// 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 )
594
594
if err != nil {
595
595
c .logger .Error ("error performing update" ,
596
596
zap .Error (err ),
@@ -826,8 +826,8 @@ func (c *M3DBController) applyStatefulSetUpdate(
826
826
return updated , nil
827
827
}
828
828
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 (
831
831
cluster * myspec.M3DBCluster ,
832
832
sts * appsv1.StatefulSet ,
833
833
) (bool , error ) {
@@ -1325,6 +1325,7 @@ func copyAnnotations(expected, actual *appsv1.StatefulSet) {
1325
1325
// updates.
1326
1326
if k == annotations .ParallelUpdate {
1327
1327
expected .Annotations [annotations .ParallelUpdateInProgress ] = v
1328
+ continue
1328
1329
}
1329
1330
1330
1331
if _ , ok := expected .Annotations [k ]; ! ok {
0 commit comments