diff --git a/pkg/operator/ceph/object/controller.go b/pkg/operator/ceph/object/controller.go index a9c94ba8d..c56c69fbc 100644 --- a/pkg/operator/ceph/object/controller.go +++ b/pkg/operator/ceph/object/controller.go @@ -24,7 +24,6 @@ import ( "syscall" "time" - "github.com/ceph/go-ceph/rgw/admin" "github.com/coreos/pkg/capnslog" bktclient "github.com/kube-object-storage/lib-bucket-provisioner/pkg/client/clientset/versioned" "github.com/pkg/errors" @@ -245,11 +244,6 @@ func (r *ReconcileCephObjectStore) reconcile(request reconcile.Request) (reconci return reconcile.Result{}, *cephObjectStore, errors.Wrapf(err, "failed to get admin ops API context") } - // ignore any errors coming from this for the deletion case since we could get into a - // partially-deleted case where RGWs aren't responding. Deletion will be blocked later if - // the bucket fails to be deleted and the RGWs are running. - _ = removeDeprecatedHealthCheckBucket(r.clusterInfo.Context, opsCtx, cephObjectStore) - deps, err := cephObjectStoreDependents(r.context, r.clusterInfo, cephObjectStore, objCtx, opsCtx) if err != nil { return reconcile.Result{}, *cephObjectStore, err @@ -333,19 +327,6 @@ func (r *ReconcileCephObjectStore) reconcile(request reconcile.Request) (reconci return result, *cephObjectStore, err } - objCtx, err := NewMultisiteContext(r.context, r.clusterInfo, cephObjectStore) - if err != nil { - return reconcile.Result{}, *cephObjectStore, errors.Wrapf(err, "failed to get object context") - } - opsCtx, err := NewMultisiteAdminOpsContext(objCtx, &cephObjectStore.Spec) - if err != nil { - return reconcile.Result{}, *cephObjectStore, errors.Wrapf(err, "failed to get admin ops API context") - } - err = removeDeprecatedHealthCheckBucket(r.clusterInfo.Context, opsCtx, cephObjectStore) - if err != nil { - return reconcile.Result{}, *cephObjectStore, errors.Wrap(err, "updated object store but failed to remove deprecated health check bucket") - } - // update ObservedGeneration in status at the end of reconcile // Set Progressing status, we are done reconciling, the health check go routine will update the status updateStatus(r.opManagerContext, observedGeneration, r.client, request.NamespacedName, cephv1.ConditionReady, buildStatusInfo(cephObjectStore)) @@ -538,41 +519,3 @@ func (r *ReconcileCephObjectStore) reconcileMultisiteCRs(cephObjectStore *cephv1 return cephObjectStore.Name, cephObjectStore.Name, cephObjectStore.Name, nil, reconcile.Result{}, nil } - -// handle upgrade from v1.10; we need to remove the health checker bucket from the store, or -// deleting the store will be stuck on dependents because an unknown bucket exists -// TODO: remove this for Rook v1.12 release -var removeDeprecatedHealthCheckBucket = func(ctx context.Context, opsCtx *AdminOpsContext, cos *cephv1.CephObjectStore) error { - healthCheckBucket := genHealthCheckerBucketName(string(cos.UID)) - doPurge := true // purge all content of the bucket - bucket := admin.Bucket{Bucket: healthCheckBucket, PurgeObject: &doPurge} - remErr := opsCtx.AdminOpsClient.RemoveBucket(ctx, bucket) - - if remErr == nil { - logger.Info("successfully deleted deprecated health checker bucket") - return nil - } - - if errors.Is(remErr, admin.ErrNoSuchBucket) { - logger.Debug("deprecated health checker bucket already does not exist: NoSuchBucket") - return nil - } - - if errors.Is(remErr, admin.ErrNoSuchKey) { - // ceph might return NoSuchKey than NoSuchBucket when the target bucket does not exist. - // then we can use GetBucketInfo() to judge the existence of the bucket. - // see: https://github.com/ceph/ceph/pull/44413 - _, getErr := opsCtx.AdminOpsClient.GetBucketInfo(ctx, bucket) - if getErr != nil { - if errors.Is(getErr, admin.ErrNoSuchBucket) { - logger.Debug("deprecated health checker bucket already does not exist: NoSuchKey") - return nil - } - // both commands errored; something is up; be sure to return both errors - return errors.Wrapf(remErr, "failed to delete deprecated health checker bucket %q. failed to get bucket info. %v", healthCheckBucket, getErr) - } - // remove bucket failed, and bucket exists; something else went wrong with remove bucket - } - - return errors.Wrapf(remErr, "failed to delete deprecated health checker bucket %q", healthCheckBucket) -} diff --git a/pkg/operator/ceph/object/controller_test.go b/pkg/operator/ceph/object/controller_test.go index f2bd11ae8..b82d49b45 100644 --- a/pkg/operator/ceph/object/controller_test.go +++ b/pkg/operator/ceph/object/controller_test.go @@ -19,7 +19,6 @@ package object import ( "context" - "fmt" "os" "reflect" "testing" @@ -528,10 +527,6 @@ func TestCephObjectStoreController(t *testing.T) { t.Run("success - object store is running", func(t *testing.T) { r := setupEnvironmentWithReadyCephCluster() - removeDeprecatedHealthCheckBucket = func(ctx context.Context, opsCtx *AdminOpsContext, cos *cephv1.CephObjectStore) error { - return nil - } - res, err := r.Reconcile(ctx, req) assert.NoError(t, err) assert.False(t, res.Requeue) @@ -545,18 +540,6 @@ func TestCephObjectStoreController(t *testing.T) { assert.True(t, calledCommitConfigChanges) assert.Equal(t, 16, r.clusterInfo.CephVersion.Major) }) - - t.Run("failed to remove deprecated health check bucket", func(t *testing.T) { - r := setupEnvironmentWithReadyCephCluster() - - removeDeprecatedHealthCheckBucket = func(ctx context.Context, opsCtx *AdminOpsContext, cos *cephv1.CephObjectStore) error { - return fmt.Errorf("induced error") - } - - _, err := r.Reconcile(ctx, req) - assert.Error(t, err) - assert.Contains(t, err.Error(), "deprecated health check bucket") - }) } func TestCephObjectStoreControllerMultisite(t *testing.T) { @@ -754,10 +737,6 @@ func TestCephObjectStoreControllerMultisite(t *testing.T) { return &cephver.Pacific, &cephver.Pacific, nil } - removeDeprecatedHealthCheckBucket = func(ctx context.Context, opsCtx *AdminOpsContext, cos *cephv1.CephObjectStore) error { - return nil - } - t.Run("create an object store", func(t *testing.T) { res, err := r.Reconcile(ctx, req) assert.NoError(t, err) @@ -939,10 +918,6 @@ func TestCephObjectExternalStoreController(t *testing.T) { r := getReconciler(objects) - removeDeprecatedHealthCheckBucket = func(ctx context.Context, opsCtx *AdminOpsContext, cos *cephv1.CephObjectStore) error { - return nil - } - t.Run("create an external object store", func(t *testing.T) { res, err := r.Reconcile(ctx, req) assert.NoError(t, err) diff --git a/pkg/operator/ceph/object/dependents.go b/pkg/operator/ceph/object/dependents.go index 4493cd80e..b9d0cc240 100644 --- a/pkg/operator/ceph/object/dependents.go +++ b/pkg/operator/ceph/object/dependents.go @@ -30,7 +30,6 @@ import ( const ( bucketDependentType = "buckets in the object store (could be from ObjectBucketClaims or COSI Buckets)" zoneIsMasterWithPeersDependentType = "zone is master and has peers" - s3HealthCheckBucketName = "rook-ceph-bucket-checker" ) // CephObjectStoreDependents returns the buckets which exist in the object store that should block @@ -162,7 +161,3 @@ func getMasterZoneDependents( } return nil } - -func genHealthCheckerBucketName(uuid string) string { - return fmt.Sprintf("%s-%s", s3HealthCheckBucketName, uuid) -}