diff --git a/workflow/controller/healthz.go b/workflow/controller/healthz.go index a0dcc92b8377..b1d882b40c9c 100644 --- a/workflow/controller/healthz.go +++ b/workflow/controller/healthz.go @@ -33,6 +33,11 @@ func (wfc *WorkflowController) Healthz(w http.ResponseWriter, r *http.Request) { if err != nil { return err } + // the wfc.wfInformer is nil if it is not the leader + if wfc.wfInformer == nil { + log.Info("healthz: current pod is not the leader") + return nil + } lister := v1alpha1.NewWorkflowLister(wfc.wfInformer.GetIndexer()) list, err := lister.Workflows(wfc.managedNamespace).List(seletor) if err != nil {