diff --git a/internal/controller/bucket/helpers.go b/internal/controller/bucket/helpers.go index b8f62d7f..516cef13 100644 --- a/internal/controller/bucket/helpers.go +++ b/internal/controller/bucket/helpers.go @@ -15,7 +15,6 @@ import ( "github.com/linode/provider-ceph/internal/consts" "github.com/linode/provider-ceph/internal/utils" "go.opentelemetry.io/otel" - "sigs.k8s.io/controller-runtime/pkg/client" kerrors "k8s.io/apimachinery/pkg/api/errors" "k8s.io/apimachinery/pkg/types" @@ -241,13 +240,12 @@ func (c *external) updateBucketCR(ctx context.Context, bucket *v1alpha1.Bucket, ctx, span := otel.Tracer("").Start(ctx, "bucket.external.updateBucketCR") defer span.End() - bucketDeepCopy := &v1alpha1.Bucket{} nn := types.NamespacedName{Name: bucket.GetName()} err := retry.OnError(retry.DefaultRetry, resource.IsAPIError, func() error { if err := c.kubeClient.Get(ctx, nn, bucket); err != nil { return err } - bucketDeepCopy = bucket.DeepCopy() + return nil }) if err != nil { @@ -262,9 +260,9 @@ func (c *external) updateBucketCR(ctx context.Context, bucket *v1alpha1.Bucket, if err := retry.OnError(retry.DefaultRetry, resource.IsAPIError, func() error { switch cb(bucket) { case NeedsStatusUpdate: - return c.kubeClient.Status().Patch(ctx, bucket, client.MergeFrom(bucketDeepCopy)) + return c.kubeClient.Status().Update(ctx, bucket) case NeedsObjectUpdate: - return c.kubeClient.Patch(ctx, bucket, client.MergeFrom(bucketDeepCopy)) + return c.kubeClient.Update(ctx, bucket) default: return nil }