Skip to content

Commit 116ff8f

Browse files
Nikhil-Ladhamergify[bot]
authored andcommitted
fix promotion condtion update for VR
fix promotion condition update for VR due to intermittent condition updates Signed-off-by: Nikhil-Ladha <nikhilladha1999@gmail.com>
1 parent b78405b commit 116ff8f

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

internal/controller/replication.storage/volumereplication_controller.go

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -337,6 +337,12 @@ func (r *VolumeReplicationReconciler) Reconcile(ctx context.Context, req ctrl.Re
337337
replicationErr = r.markVolumeAsPrimary(vr)
338338
}
339339

340+
// Set PromotedCondition on VR/VGR, if the promotion was a success, or it was already a primary and the
341+
// status was updated due to some intermittent bug
342+
if replicationErr == nil {
343+
setPromotedCondition(&vr.instance.Status.Conditions, vr.instance.Generation, vr.instance.Spec.DataSource.Kind)
344+
}
345+
340346
case replicationv1alpha1.Secondary:
341347
// For the first time, mark the volume as secondary and requeue the
342348
// request. For some storage providers it takes some time to determine
@@ -628,8 +634,6 @@ func (r *VolumeReplicationReconciler) markVolumeAsPrimary(vr *volumeReplicationI
628634
}
629635
}
630636

631-
setPromotedCondition(&vr.instance.Status.Conditions, vr.instance.Generation, vr.instance.Spec.DataSource.Kind)
632-
633637
return nil
634638
}
635639

0 commit comments

Comments
 (0)