From b464eb2ca808ed2193f901b2761b824036e5c4f4 Mon Sep 17 00:00:00 2001 From: Rewant Soni Date: Tue, 3 Dec 2024 23:58:08 +0530 Subject: [PATCH] controllers: use semantic deepequal Signed-off-by: Rewant Soni --- pkg/utils/k8sutils.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkg/utils/k8sutils.go b/pkg/utils/k8sutils.go index 89cacdb5..f6ce1bb3 100644 --- a/pkg/utils/k8sutils.go +++ b/pkg/utils/k8sutils.go @@ -23,9 +23,9 @@ import ( "fmt" "maps" "os" - "reflect" "time" + "k8s.io/apimachinery/pkg/api/equality" "k8s.io/apimachinery/pkg/api/errors" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "sigs.k8s.io/controller-runtime/pkg/client" @@ -153,7 +153,7 @@ func CreateOrReplace(ctx context.Context, c client.Client, obj client.Object, f return err } - if reflect.DeepEqual(existing, obj) { + if equality.Semantic.DeepEqual(existing, obj) { return nil }