From 084e02a287f437124ec984b080077c92f6e1ac62 Mon Sep 17 00:00:00 2001 From: Maxime Bertin Date: Thu, 9 Jul 2026 13:41:53 +0200 Subject: [PATCH] file: reveal swallowed errors on cephfs reconciliation CephFS reconciliation loop on Filesystem creation was swallowing errors. The err variable which contained the error was replaced with the resulted error from the kubernetes update status call on the CRD. This commit fixes that and aggregate both errors in case there is both a kubernetes status update failure and a creation error. Signed-off-by: Maxime Bertin (cherry picked from commit 0696b24d9ce39180f0893f6c453d22c90f983490) --- pkg/operator/ceph/file/controller.go | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/pkg/operator/ceph/file/controller.go b/pkg/operator/ceph/file/controller.go index 47c5839e6..700e51443 100644 --- a/pkg/operator/ceph/file/controller.go +++ b/pkg/operator/ceph/file/controller.go @@ -375,9 +375,9 @@ func (r *ReconcileCephFilesystem) reconcile(request reconcile.Request) (reconcil log.NamedDebug(request.NamespacedName, logger, "reconciling ceph filesystem store deployments") reconcileResponse, err = r.reconcileCreateFilesystem(cephFilesystem) if err != nil { - _, err := r.updateStatus(k8sutil.ObservedGenerationNotAvailable, request.NamespacedName, cephv1.ConditionFailure, nil, nil) - if err != nil { - return reconcile.Result{}, *cephFilesystem, errors.Wrapf(err, "failed to set failure status on cephFileSystem %q when file system creation failed", request.NamespacedName) + _, statusErr := r.updateStatus(k8sutil.ObservedGenerationNotAvailable, request.NamespacedName, cephv1.ConditionFailure, nil, nil) + if statusErr != nil { + return reconcile.Result{}, *cephFilesystem, errors.Wrapf(statusErr, "failed to set failure status on cephFileSystem %q after filesystem creation error: %q", request.NamespacedName, err) } return reconcileResponse, *cephFilesystem, err } @@ -411,9 +411,9 @@ func (r *ReconcileCephFilesystem) reconcile(request reconcile.Request) (reconcil log.NamedInfo(request.NamespacedName, logger, "reconciling create cephfs-mirror peer configuration") reconcileResponse, err = opcontroller.CreateBootstrapPeerSecret(r.context, r.clusterInfo, cephFilesystem, k8sutil.NewOwnerInfo(cephFilesystem, r.scheme)) if err != nil { - _, err := r.updateStatus(k8sutil.ObservedGenerationNotAvailable, request.NamespacedName, cephv1.ConditionFailure, nil, nil) - if err != nil { - return reconcile.Result{}, *cephFilesystem, errors.Wrapf(err, "failed to set failure status on cephFileSystem %q when peer secret bootstrap failed", request.NamespacedName) + _, statusErr := r.updateStatus(k8sutil.ObservedGenerationNotAvailable, request.NamespacedName, cephv1.ConditionFailure, nil, nil) + if statusErr != nil { + return reconcile.Result{}, *cephFilesystem, errors.Wrapf(statusErr, "failed to set failure status on cephFileSystem %q after peer secret bootstrap error: %q", request.NamespacedName, err) } return reconcileResponse, *cephFilesystem, errors.Wrapf(err, "failed to create cephfs-mirror bootstrap peer for filesystem %q.", cephFilesystem.Name)