From a62b66722d03e82b6c450a34dbb760d943f555c7 Mon Sep 17 00:00:00 2001 From: Danil-Grigorev Date: Tue, 10 Dec 2024 11:24:41 +0100 Subject: [PATCH] Fix diff check on secret sync Signed-off-by: Danil-Grigorev --- internal/sync/core.go | 4 ++++ internal/sync/secret_sync.go | 5 ++--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/internal/sync/core.go b/internal/sync/core.go index a2e88c8d..019b64d8 100644 --- a/internal/sync/core.go +++ b/internal/sync/core.go @@ -61,6 +61,10 @@ func (s *DefaultSynchronizer) Get(ctx context.Context) error { // Apply applies the destination object to the cluster. func (s *DefaultSynchronizer) Apply(ctx context.Context, reterr *error) { + if s.Destination == nil { + return + } + log := log.FromContext(ctx) uid := s.Destination.GetUID() diff --git a/internal/sync/secret_sync.go b/internal/sync/secret_sync.go index 6b282a98..e7aefc86 100644 --- a/internal/sync/secret_sync.go +++ b/internal/sync/secret_sync.go @@ -19,7 +19,6 @@ package sync import ( "cmp" "context" - "encoding/base64" "maps" "strconv" @@ -94,14 +93,14 @@ func (s *SecretSync) SyncObjects() { allSet := true for k, v := range s.DefaultSynchronizer.Source.Status.Variables { - if b64value, found := s.Secret.Data[k]; !found || base64.StdEncoding.EncodeToString([]byte(v)) != string(b64value) { + if value, found := s.Secret.Data[k]; !found || v != string(value) { allSet = false break } } if allSet { - s.Secret.StringData = map[string]string{} + s.Destination = nil } }