Skip to content

Commit

Permalink
Wait for webhooks server using probes
Browse files Browse the repository at this point in the history
  • Loading branch information
mimowo committed Jan 31, 2024
1 parent f2cba29 commit 2c7918f
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
10 changes: 7 additions & 3 deletions cmd/kueue/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ package main
import (
"context"
"flag"
"net/http"
"os"

// Import all Kubernetes client auth plugins (e.g. Azure, GCP, OIDC, etc.)
Expand All @@ -38,7 +39,6 @@ import (
clientgoscheme "k8s.io/client-go/kubernetes/scheme"
"k8s.io/client-go/rest"
ctrl "sigs.k8s.io/controller-runtime"
"sigs.k8s.io/controller-runtime/pkg/healthz"
"sigs.k8s.io/controller-runtime/pkg/log/zap"

configapi "sigs.k8s.io/kueue/apis/config/v1beta1"
Expand Down Expand Up @@ -274,11 +274,15 @@ func setupControllers(mgr ctrl.Manager, cCache *cache.Cache, queues *queue.Manag
func setupProbeEndpoints(mgr ctrl.Manager) {
defer setupLog.Info("Probe endpoints are configured on healthz and readyz")

if err := mgr.AddHealthzCheck("healthz", healthz.Ping); err != nil {
readyz := func(req *http.Request) error {
return mgr.GetWebhookServer().StartedChecker()(req)
}

if err := mgr.AddHealthzCheck("healthz", readyz); 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", readyz); err != nil {
setupLog.Error(err, "unable to set up ready check")
os.Exit(1)
}
Expand Down
1 change: 1 addition & 0 deletions hack/e2e-common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -55,5 +55,6 @@ function cluster_kueue_deploy {
else
kubectl apply --server-side -k test/e2e/config
fi
kubectl wait --for=condition=available --timeout=3m deployment/kueue-controller-manager -n kueue-system
}

2 changes: 1 addition & 1 deletion test/e2e/singlecluster/suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,5 +54,5 @@ var _ = ginkgo.BeforeSuite(func() {
visibilityClient = util.CreateVisibilityClient("")
impersonatedVisibilityClient = util.CreateVisibilityClient("system:serviceaccount:kueue-system:default")
ctx = context.Background()
util.KueueReadyForTesting(ctx, k8sClient)
// util.KueueReadyForTesting(ctx, k8sClient)
})

0 comments on commit 2c7918f

Please sign in to comment.