From 02b9df671120c7f0cbb6a027adc9acc7acf53f0b Mon Sep 17 00:00:00 2001 From: Mike Rostermund Date: Thu, 12 Dec 2024 10:06:20 +0100 Subject: [PATCH] Fix bug when skipping certificate if used by pods created during same reconcile --- controllers/humiocluster_pods.go | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/controllers/humiocluster_pods.go b/controllers/humiocluster_pods.go index 82fd562e..6239da2b 100644 --- a/controllers/humiocluster_pods.go +++ b/controllers/humiocluster_pods.go @@ -898,13 +898,18 @@ func findHumioNodeNameAndCertHash(ctx context.Context, c client.Client, hnp *Hum return podNameAndCertificateHash{}, err } for _, certificate := range certificates { + certificateUsedByNewlyCreatedPods := false for _, newPod := range newlyCreatedPods { if certificate.Name == newPod.Name { - // ignore any certificates that matches names of pods we've just created - continue + certificateUsedByNewlyCreatedPods = true } } + if certificateUsedByNewlyCreatedPods { + // ignore any certificates that matches names of pods we've just created + continue + } + if certificate.Spec.Keystores == nil { // ignore any certificates that does not hold a keystore bundle continue