From 99a171302bb47f2abef8d566f733248cccfd8a43 Mon Sep 17 00:00:00 2001 From: Tesshu Flower Date: Mon, 16 Dec 2024 20:53:47 -0500 Subject: [PATCH] include error in msg from healthchecker (#296) Signed-off-by: Tesshu Flower --- .../agentdeploy/healthcheck_sync.go | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/pkg/addonmanager/controllers/agentdeploy/healthcheck_sync.go b/pkg/addonmanager/controllers/agentdeploy/healthcheck_sync.go index e81c0225..049622ca 100644 --- a/pkg/addonmanager/controllers/agentdeploy/healthcheck_sync.go +++ b/pkg/addonmanager/controllers/agentdeploy/healthcheck_sync.go @@ -227,14 +227,16 @@ func (s *healthCheckSyncer) probeAddonStatusByWorks( } - if healthChecker != nil && healthChecker(FieldResults, cluster, addon) != nil { - meta.SetStatusCondition(&addon.Status.Conditions, metav1.Condition{ - Type: addonapiv1alpha1.ManagedClusterAddOnConditionAvailable, - Status: metav1.ConditionFalse, - Reason: addonapiv1alpha1.AddonAvailableReasonProbeUnavailable, - Message: fmt.Sprintf("Probe addon unavailable with err %v", err), - }) - return nil + if healthChecker != nil { + if err := healthChecker(FieldResults, cluster, addon); err != nil { + meta.SetStatusCondition(&addon.Status.Conditions, metav1.Condition{ + Type: addonapiv1alpha1.ManagedClusterAddOnConditionAvailable, + Status: metav1.ConditionFalse, + Reason: addonapiv1alpha1.AddonAvailableReasonProbeUnavailable, + Message: fmt.Sprintf("Probe addon unavailable with err %v", err), + }) + return nil + } } meta.SetStatusCondition(&addon.Status.Conditions, metav1.Condition{