From 1ddacfda62295732f53c6940f18ed4663001f8a9 Mon Sep 17 00:00:00 2001 From: Daniel Hougaard <62331820+DanielHougaard@users.noreply.github.com> Date: Fri, 28 Jun 2024 21:29:33 +0200 Subject: [PATCH] Fix: Annotations map nil sometimes nil when pre-created by the user --- k8-operator/controllers/infisicalsecret_helper.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/k8-operator/controllers/infisicalsecret_helper.go b/k8-operator/controllers/infisicalsecret_helper.go index 9ae6ad69a..f92275af4 100644 --- a/k8-operator/controllers/infisicalsecret_helper.go +++ b/k8-operator/controllers/infisicalsecret_helper.go @@ -267,6 +267,11 @@ func (r *InfisicalSecretReconciler) UpdateInfisicalManagedKubeSecret(ctx context plainProcessedSecrets[secret.Key] = []byte(secret.Value) } + // Initialize the Annotations map if it's nil + if managedKubeSecret.ObjectMeta.Annotations == nil { + managedKubeSecret.ObjectMeta.Annotations = make(map[string]string) + } + managedKubeSecret.Data = plainProcessedSecrets managedKubeSecret.ObjectMeta.Annotations[SECRET_VERSION_ANNOTATION] = ETag