From 21cec7cd4652214338c27f14e5e6de124a5b5807 Mon Sep 17 00:00:00 2001 From: nolancon Date: Mon, 16 Dec 2024 11:33:09 -0500 Subject: [PATCH] Use Patch for status update --- internal/controller/bucket/helpers.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/internal/controller/bucket/helpers.go b/internal/controller/bucket/helpers.go index 9bdc598d..4110f2ea 100644 --- a/internal/controller/bucket/helpers.go +++ b/internal/controller/bucket/helpers.go @@ -15,6 +15,7 @@ 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" @@ -247,9 +248,10 @@ func (c *external) updateBucketCR(ctx context.Context, bucket *v1alpha1.Bucket, if err := c.kubeClient.Get(ctx, nn, bucket); err != nil { return err } + bucketDeepCopy := bucket.DeepCopy() switch cb(bucket) { case NeedsStatusUpdate: - return c.kubeClient.Status().Update(ctx, bucket) + return c.kubeClient.Status().Patch(ctx, bucket, client.MergeFrom(bucketDeepCopy)) case NeedsObjectUpdate: return c.kubeClient.Update(ctx, bucket) default: