diff --git a/bootstrap/kubeadm/main.go b/bootstrap/kubeadm/main.go index 5c4f3da29fb9..45fe41ad8ee7 100644 --- a/bootstrap/kubeadm/main.go +++ b/bootstrap/kubeadm/main.go @@ -44,7 +44,6 @@ import ( ctrl "sigs.k8s.io/controller-runtime" "sigs.k8s.io/controller-runtime/pkg/client" "sigs.k8s.io/controller-runtime/pkg/controller" - "sigs.k8s.io/controller-runtime/pkg/healthz" // +kubebuilder:scaffold:imports ) @@ -185,12 +184,12 @@ func main() { } func setupChecks(mgr ctrl.Manager) { - if err := mgr.AddReadyzCheck("ping", healthz.Ping); err != nil { + if err := mgr.AddReadyzCheck("webhook", mgr.GetWebhookServer().StartedChecker()); err != nil { setupLog.Error(err, "unable to create ready check") os.Exit(1) } - if err := mgr.AddHealthzCheck("ping", healthz.Ping); err != nil { + if err := mgr.AddHealthzCheck("webhook", mgr.GetWebhookServer().StartedChecker()); err != nil { setupLog.Error(err, "unable to create health check") os.Exit(1) } diff --git a/controlplane/kubeadm/main.go b/controlplane/kubeadm/main.go index ce3714694b8e..5260f16ac86c 100644 --- a/controlplane/kubeadm/main.go +++ b/controlplane/kubeadm/main.go @@ -44,7 +44,6 @@ import ( ctrl "sigs.k8s.io/controller-runtime" "sigs.k8s.io/controller-runtime/pkg/client" "sigs.k8s.io/controller-runtime/pkg/controller" - "sigs.k8s.io/controller-runtime/pkg/healthz" // +kubebuilder:scaffold:imports ) @@ -179,12 +178,12 @@ func main() { } func setupChecks(mgr ctrl.Manager) { - if err := mgr.AddReadyzCheck("ping", healthz.Ping); err != nil { + if err := mgr.AddReadyzCheck("webhook", mgr.GetWebhookServer().StartedChecker()); err != nil { setupLog.Error(err, "unable to create ready check") os.Exit(1) } - if err := mgr.AddHealthzCheck("ping", healthz.Ping); err != nil { + if err := mgr.AddHealthzCheck("webhook", mgr.GetWebhookServer().StartedChecker()); err != nil { setupLog.Error(err, "unable to create health check") os.Exit(1) } diff --git a/main.go b/main.go index 3f0bfe1cda7b..4b2445ab2632 100644 --- a/main.go +++ b/main.go @@ -49,7 +49,6 @@ import ( ctrl "sigs.k8s.io/controller-runtime" "sigs.k8s.io/controller-runtime/pkg/client" "sigs.k8s.io/controller-runtime/pkg/controller" - "sigs.k8s.io/controller-runtime/pkg/healthz" // +kubebuilder:scaffold:imports ) @@ -218,12 +217,12 @@ func main() { } func setupChecks(mgr ctrl.Manager) { - if err := mgr.AddReadyzCheck("ping", healthz.Ping); err != nil { + if err := mgr.AddReadyzCheck("webhook", mgr.GetWebhookServer().StartedChecker()); err != nil { setupLog.Error(err, "unable to create ready check") os.Exit(1) } - if err := mgr.AddHealthzCheck("ping", healthz.Ping); err != nil { + if err := mgr.AddHealthzCheck("webhook", mgr.GetWebhookServer().StartedChecker()); err != nil { setupLog.Error(err, "unable to create health check") os.Exit(1) } diff --git a/test/infrastructure/docker/main.go b/test/infrastructure/docker/main.go index a54aef627ea6..4724fac33b22 100644 --- a/test/infrastructure/docker/main.go +++ b/test/infrastructure/docker/main.go @@ -37,7 +37,6 @@ import ( "sigs.k8s.io/cluster-api/feature" ctrl "sigs.k8s.io/controller-runtime" "sigs.k8s.io/controller-runtime/pkg/controller" - "sigs.k8s.io/controller-runtime/pkg/healthz" infrav1old "sigs.k8s.io/cluster-api/test/infrastructure/docker/api/v1alpha3" infrav1 "sigs.k8s.io/cluster-api/test/infrastructure/docker/api/v1alpha4" @@ -137,12 +136,12 @@ func main() { } func setupChecks(mgr ctrl.Manager) { - if err := mgr.AddReadyzCheck("ping", healthz.Ping); err != nil { + if err := mgr.AddReadyzCheck("webhook", mgr.GetWebhookServer().StartedChecker()); err != nil { setupLog.Error(err, "unable to create ready check") os.Exit(1) } - if err := mgr.AddHealthzCheck("ping", healthz.Ping); err != nil { + if err := mgr.AddHealthzCheck("webhook", mgr.GetWebhookServer().StartedChecker()); err != nil { setupLog.Error(err, "unable to create health check") os.Exit(1) }