From 8a96f5f14b541f3dfd016cb286871fda664ae578 Mon Sep 17 00:00:00 2001 From: craig Date: Wed, 30 Oct 2024 10:38:12 +0000 Subject: [PATCH] add few additonal logs Signed-off-by: craig rh-pre-commit.version: 2.2.0 rh-pre-commit.check-secrets: ENABLED --- internal/controller/dnshealthcheckprobe_reconciler.go | 5 +++-- internal/probes/worker.go | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/internal/controller/dnshealthcheckprobe_reconciler.go b/internal/controller/dnshealthcheckprobe_reconciler.go index c77c202..5844c2a 100644 --- a/internal/controller/dnshealthcheckprobe_reconciler.go +++ b/internal/controller/dnshealthcheckprobe_reconciler.go @@ -67,6 +67,8 @@ func (r *DNSProbeReconciler) Reconcile(ctx context.Context, req ctrl.Request) (c ctx, _ = r.setLoggerValues(ctx, baseLogger, dnsProbe) if dnsProbe.DeletionTimestamp != nil && !dnsProbe.DeletionTimestamp.IsZero() { + logger.Info("healthcheckprobe deleted cleaning up workers") + r.ProbeManager.StopProbeWorker(ctx, dnsProbe) controllerutil.RemoveFinalizer(dnsProbe, DNSHealthCheckFinalizer) if err = r.Update(ctx, dnsProbe); client.IgnoreNotFound(err) != nil { if apierrors.IsConflict(err) { @@ -74,8 +76,7 @@ func (r *DNSProbeReconciler) Reconcile(ctx context.Context, req ctrl.Request) (c } return ctrl.Result{}, err } - logger.Info("healthcheckprobe deleted cleaning up workers") - r.ProbeManager.StopProbeWorker(ctx, dnsProbe) + return ctrl.Result{}, nil } diff --git a/internal/probes/worker.go b/internal/probes/worker.go index 7700825..07d13f3 100644 --- a/internal/probes/worker.go +++ b/internal/probes/worker.go @@ -191,7 +191,7 @@ func (w *Probe) performRequest(ctx context.Context, protocol, host, path, ip str } else if err != nil { return ProbeResult{CheckedAt: metav1.Now(), Healthy: false, Reason: fmt.Sprintf("error: %s, response: %+v", err.Error(), res)} } - + logger.V(1).Info("health: probe execution complete against ", "url", httpReq.URL, "status code", res.StatusCode) if !slice.Contains[int](ExpectedResponses, func(i int) bool { return i == res.StatusCode }) { return ProbeResult{ CheckedAt: metav1.Now(),