Skip to content

Commit 61c6dde

Browse files
committed
re-read the sts for checking the annotation fixing both pvc resize flows
1 parent dc9bccd commit 61c6dde

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

pkg/controller/perconaservermongodb/statefulset.go

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,9 +62,15 @@ func (r *ReconcilePerconaServerMongoDB) reconcileStatefulSet(ctx context.Context
6262
return nil, errors.Wrapf(err, "reconcile PVCs for %s", sfs.Name)
6363
}
6464

65-
if _, ok := sfs.Annotations[api.AnnotationPVCResizeInProgress]; ok {
66-
log.V(1).Info("PVC resize in progress, skipping reconciliation of statefulset", "name", sfs.Name)
67-
return sfs, nil
65+
// Re-read the StatefulSet from the cluster to check for the PVC resize
66+
// annotation, as it may have been set during reconcilePVCs and the local
67+
// sfs object would be stale.
68+
currentSts := new(appsv1.StatefulSet)
69+
if err := r.client.Get(ctx, types.NamespacedName{Name: sfs.Name, Namespace: sfs.Namespace}, currentSts); err == nil {
70+
if _, ok := currentSts.Annotations[api.AnnotationPVCResizeInProgress]; ok {
71+
log.V(1).Info("PVC resize in progress, skipping reconciliation of statefulset", "name", sfs.Name)
72+
return sfs, nil
73+
}
6874
}
6975

7076
err = r.createOrUpdate(ctx, sfs)

0 commit comments

Comments
 (0)