csi: do not block the reconcile if all clusters are not ready

If some clusters don't have their monitors up and running, we don't have
a clusterInfo (internal detail struct). We don't want to block the csi
controller reconcile if all the clusters are not ready. So let's proceed
with the elements that are ready and reconcile again to see if others
have made progress.

Signed-off-by: Sébastien Han <seb@redhat.com>
This commit is contained in:
Sébastien Han committed 2022-06-03 10:59:31 +02:00
1 parent dc525d2121
commit 95b2e60679
1 file changed
+9 -3
+9 -3
View File
@@ -116,6 +116,9 @@ func (r *ReconcileCSI) Reconcile(context context.Context, request reconcile.Requ
}
func (r *ReconcileCSI) reconcile(request reconcile.Request) (reconcile.Result, error) {
// reconcileResult is used to communicate the result of the reconciliation back to the caller
var reconcileResult reconcile.Result
serverVersion, err := r.context.Clientset.Discovery().ServerVersion()
if err != nil {
return opcontroller.ImmediateRetryResult, errors.Wrap(err, "failed to get server version")
@@ -150,6 +153,7 @@ func (r *ReconcileCSI) reconcile(request reconcile.Request) (reconcile.Result, e
return reconcile.Result{}, nil
}
for i, cluster := range cephClusters.Items {
if !cluster.DeletionTimestamp.IsZero() {
logger.Debugf("ceph cluster %q is being deleting, no need to reconcile the csi driver", request.NamespacedName)
@@ -170,9 +174,11 @@ func (r *ReconcileCSI) reconcile(request reconcile.Request) (reconcile.Result, e
// This avoids a requeue with exponential backoff and allows the controller to reconcile
// more quickly when the cluster is ready.
if errors.Is(err, opcontroller.ClusterInfoNoClusterNoSecret) {
return opcontroller.WaitForRequeueIfCephClusterNotReady, nil
logger.Infof("cluster info for cluster %q is not ready yet, will retry in %s, proceeding with ready clusters", cluster.Name, opcontroller.WaitForRequeueIfCephClusterNotReady.RequeueAfter.String())
reconcileResult = opcontroller.WaitForRequeueIfCephClusterNotReady
continue
}
return opcontroller.ImmediateRetryResult, errors.Wrapf(err, "failed to populate cluster info for cluster %q", cluster.Name)
return opcontroller.ImmediateRetryResult, errors.Wrapf(err, "failed to load cluster info for cluster %q", cluster.Name)
}
logger.Debugf("cluster %q is running on multus, deploying the ceph-csi plugin holder", cluster.Name)
@@ -234,5 +240,5 @@ func (r *ReconcileCSI) reconcile(request reconcile.Request) (reconcile.Result, e
return opcontroller.ImmediateRetryResult, errors.Wrap(err, "failed to configure ceph csi")
}
return reconcile.Result{}, nil
return reconcileResult, nil
}