From 1d60ebc98f03f7ac21ccc914788669e3a9cb1005 Mon Sep 17 00:00:00 2001 From: Ryotaro Banno Date: Tue, 3 Dec 2024 05:25:22 +0000 Subject: [PATCH] fixup! add garbage collector runner to remove orphan PVs --- internal/controller/garbage_collector_runner.go | 2 +- internal/controller/garbage_collector_runner_test.go | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/internal/controller/garbage_collector_runner.go b/internal/controller/garbage_collector_runner.go index 1b5039b..ae46744 100644 --- a/internal/controller/garbage_collector_runner.go +++ b/internal/controller/garbage_collector_runner.go @@ -111,7 +111,7 @@ func (r *GarbageCollectorRunner) isMantleRestoreAlreadyDeleted(ctx context.Conte return false, fmt.Errorf("failed to find cluster ID: %s", pv.GetName()) } if r.managedCephClusterID != clusterID { - return false, fmt.Errorf("PV is not managed by target Ceph cluster: %s: %s", clusterID, r.managedCephClusterID) + return false, nil } var restore mantlev1.MantleRestore diff --git a/internal/controller/garbage_collector_runner_test.go b/internal/controller/garbage_collector_runner_test.go index 79ab736..51dbfca 100644 --- a/internal/controller/garbage_collector_runner_test.go +++ b/internal/controller/garbage_collector_runner_test.go @@ -93,6 +93,14 @@ var _ = Describe("garbage collector", func() { }, true, false, ), + Entry( + "cluster ID does not match", + true, + func(pv *corev1.PersistentVolume) { + pv.Spec.CSI.VolumeAttributes["clusterID"] = "different-cluster-id" + }, + false, false, + ), ) })