Skip to content

Commit

Permalink
Merge pull request #163 from kajinamit/webhook-checker
Browse files Browse the repository at this point in the history
Ensure webhook is started
  • Loading branch information
openshift-merge-robot authored Aug 24, 2023
2 parents 37e5b93 + 49b7e0c commit ac5d892
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,7 @@ func main() {
telemetryv1.SetupDefaultsInfraCompute()

// Setup webhooks if requested
checker := healthz.Ping
if strings.ToLower(os.Getenv("ENABLE_WEBHOOKS")) != "false" {
if err = (&telemetryv1.Telemetry{}).SetupWebhookWithManager(mgr); err != nil {
setupLog.Error(err, "unable to create webhook", "webhook", "Telemetry")
Expand All @@ -177,13 +178,14 @@ func main() {
setupLog.Error(err, "unable to create webhook", "webhook", "InfraCompute")
os.Exit(1)
}
checker = mgr.GetWebhookServer().StartedChecker()
}

if err := mgr.AddHealthzCheck("healthz", healthz.Ping); err != nil {
if err := mgr.AddHealthzCheck("healthz", checker); err != nil {
setupLog.Error(err, "unable to set up health check")
os.Exit(1)
}
if err := mgr.AddReadyzCheck("readyz", healthz.Ping); err != nil {
if err := mgr.AddReadyzCheck("readyz", checker); err != nil {
setupLog.Error(err, "unable to set up ready check")
os.Exit(1)
}
Expand Down

0 comments on commit ac5d892

Please sign in to comment.