Fix: Annotations map nil sometimes nil when pre-created by the user

This commit is contained in:
Daniel Hougaard
2024-06-28 21:29:33 +02:00
parent 351d0d0662
commit 1ddacfda62

View File

@@ -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