From 0c76be8c38766d97140d4b2746f673eb8ee8362d Mon Sep 17 00:00:00 2001 From: Blaine Gardner Date: Mon, 13 Dec 2021 16:07:01 -0700 Subject: [PATCH] pool: file: object: clean up health checkers for force deletion When CephBlockPool, CephFilesystem, or CephObjectStore resources are deleted after removing their finalizer, the code path to stop monitoring was not stopping monitoring since a non-present resource does not have a name and namespace attached. When the object is deleted, ensure the internal representation used to stop monitoring has a name and namespace to fix the issue. Signed-off-by: Blaine Gardner --- pkg/operator/ceph/file/controller.go | 2 ++ pkg/operator/ceph/object/controller.go | 2 ++ pkg/operator/ceph/pool/controller.go | 2 ++ 3 files changed, 6 insertions(+) diff --git a/pkg/operator/ceph/file/controller.go b/pkg/operator/ceph/file/controller.go index 85fc15df9178..f3c490c73dd6 100644 --- a/pkg/operator/ceph/file/controller.go +++ b/pkg/operator/ceph/file/controller.go @@ -170,6 +170,8 @@ func (r *ReconcileCephFilesystem) reconcile(request reconcile.Request) (reconcil // If there was a previous error or if a user removed this resource's finalizer, it's // possible Rook didn't clean up the monitoring routine for this resource. Ensure the // routine is stopped when we see the resource is gone. + cephFilesystem.Name = request.Name + cephFilesystem.Namespace = request.Namespace r.cancelMirrorMonitoring(cephFilesystem) return reconcile.Result{}, nil } diff --git a/pkg/operator/ceph/object/controller.go b/pkg/operator/ceph/object/controller.go index 7725f91d250e..570d1df8c4dd 100644 --- a/pkg/operator/ceph/object/controller.go +++ b/pkg/operator/ceph/object/controller.go @@ -168,6 +168,8 @@ func (r *ReconcileCephObjectStore) reconcile(request reconcile.Request) (reconci // If there was a previous error or if a user removed this resource's finalizer, it's // possible Rook didn't clean up the monitoring routine for this resource. Ensure the // routine is stopped when we see the resource is gone. + cephObjectStore.Name = request.Name + cephObjectStore.Namespace = request.Namespace r.stopMonitoring(cephObjectStore) return reconcile.Result{}, cephObjectStore, nil } diff --git a/pkg/operator/ceph/pool/controller.go b/pkg/operator/ceph/pool/controller.go index a5c253f01da5..660c53fa08d4 100644 --- a/pkg/operator/ceph/pool/controller.go +++ b/pkg/operator/ceph/pool/controller.go @@ -151,6 +151,8 @@ func (r *ReconcileCephBlockPool) reconcile(request reconcile.Request) (reconcile // If there was a previous error or if a user removed this resource's finalizer, it's // possible Rook didn't clean up the monitoring routine for this resource. Ensure the // routine is stopped when we see the resource is gone. + cephBlockPool.Name = request.Name + cephBlockPool.Namespace = request.Namespace r.cancelMirrorMonitoring(cephBlockPool) return reconcile.Result{}, nil }