Skip to content

Commit

Permalink
feat: add liveness probe on scheduler extender
Browse files Browse the repository at this point in the history
Signed-off-by: wenqing.he <[email protected]>
  • Loading branch information
JasonHe-WQ committed Jun 14, 2024
1 parent b379f1d commit 8b4f15f
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 0 deletions.
7 changes: 7 additions & 0 deletions charts/hami/templates/scheduler/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,13 @@ spec:
volumeMounts:
- name: tls-config
mountPath: /tls
livenessProbe:
httpGet:
path: /healthz
port: 443
initialDelaySeconds: 10
periodSeconds: 10
failureThreshold: 3
volumes:
- name: tls-config
secret:
Expand Down
1 change: 1 addition & 0 deletions cmd/scheduler/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ func start() {
router.POST("/filter", routes.PredicateRoute(sher))
router.POST("/bind", routes.Bind(sher))
router.POST("/webhook", routes.WebHookRoute())
router.GET("/healthz", routes.HealthzRoute())
klog.Info("listen on ", config.HTTPBind)
if len(tlsCertFile) == 0 || len(tlsKeyFile) == 0 {
if err := http.ListenAndServe(config.HTTPBind, router); err != nil {
Expand Down
6 changes: 6 additions & 0 deletions pkg/scheduler/routes/route.go
Original file line number Diff line number Diff line change
Expand Up @@ -132,3 +132,9 @@ func WebHookRoute() httprouter.Handle {
h.ServeHTTP(w, r)
}
}

func HealthzRoute() httprouter.Handle {
return func(w http.ResponseWriter, r *http.Request, _ httprouter.Params) {
w.WriteHeader(http.StatusOK)
}
}

0 comments on commit 8b4f15f

Please sign in to comment.