From bbae6a37d51506b03a0879b63a88652a222d94c2 Mon Sep 17 00:00:00 2001 From: Johannes Malsam Date: Thu, 25 Jan 2024 14:26:09 +0100 Subject: [PATCH] do not try to set ownerreference if secret not exists --- fleetshard/pkg/central/reconciler/reconciler.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/fleetshard/pkg/central/reconciler/reconciler.go b/fleetshard/pkg/central/reconciler/reconciler.go index d3da0c0c5b..c26700e083 100644 --- a/fleetshard/pkg/central/reconciler/reconciler.go +++ b/fleetshard/pkg/central/reconciler/reconciler.go @@ -908,6 +908,10 @@ func (r *CentralReconciler) encryptSecrets(secrets map[string]*corev1.Secret) (m func (r *CentralReconciler) ensureCentralTLSSecretHasOwnerReference(ctx context.Context, remoteCentral *private.ManagedCentral, central *v1alpha1.Central) error { secret, err := r.getSecret(remoteCentral.Metadata.Namespace, k8s.CentralTLSSecretName) if err != nil { + if apiErrors.IsNotFound(err) { + // no need to ensure correct owner reference if the secret doesn't exist + return nil + } return err }