Wait for webhook readiness and healthy
This change adds a ready and health check on the webhook server.
@@ -36,7 +36,6 @@ import (
"k8s.io/klog/v2/klogr"
ctrl "sigs.k8s.io/controller-runtime"
"sigs.k8s.io/controller-runtime/pkg/controller"
- "sigs.k8s.io/controller-runtime/pkg/healthz"
clusterv1 "sigs.k8s.io/cluster-api/api/v1alpha4"
clusterv1exp "sigs.k8s.io/cluster-api/exp/api/v1alpha4"
@@ -261,12 +260,12 @@ func main() {
// +kubebuilder:scaffold:builder
- 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)
}
