Skip to content
This repository has been archived by the owner on Dec 16, 2024. It is now read-only.

Commit

Permalink
fix probe status update when missing headers secret
Browse files Browse the repository at this point in the history
  • Loading branch information
philbrookes committed Sep 20, 2023
1 parent 8d68f2a commit f45eebd
Showing 1 changed file with 13 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,18 @@ func (r *DNSHealthCheckProbeReconciler) Reconcile(ctx context.Context, req ctrl.
additionalHeaders, err := getAdditionalHeaders(ctx, r.Client, probeObj)

if err != nil {
//update probe status, ignore update errors
_ = r.Client.Status().Update(ctx, probeObj)
f := false
logger.V(1).Info(
"error getting additional headers for probe",
"secret name", probeObj.Spec.AdditionalHeadersRef.Name,
"error", err)
//update probe status
probeObj.Status.Healthy = &f
probeObj.Status.LastCheckedAt = metav1.Now()
updateErr := r.Client.Status().Update(ctx, probeObj)
if updateErr != nil {
logger.V(1).Info("error updating probe status", "error", updateErr)
}
return ctrl.Result{}, err
}

Expand Down Expand Up @@ -160,7 +170,7 @@ func getAdditionalHeaders(ctx context.Context, clt client.Client, probeObj *v1al
} else if err != nil {
probeError := fmt.Errorf("error retrieving additional headers secret %v/%v: %w", secretKey.Namespace, secretKey.Name, err)
probeObj.Status.ConsecutiveFailures = 0
probeObj.Status.Reason = "additional headers secret not found"
probeObj.Status.Reason = fmt.Sprintf("additional headers secret '%v' not found", secretKey.Name)
return additionalHeaders, probeError
}
for k, v := range additionalHeadersSecret.Data {
Expand Down

0 comments on commit f45eebd

Please sign in to comment.