1
0
Fork 0
mirror of https://github.com/kyverno/kyverno.git synced 2025-03-06 07:57:07 +00:00
kyverno/pkg/webhooks/handlers/probe.go

18 lines
315 B
Go
Raw Normal View History

package handlers
import (
"context"
"net/http"
)
func Probe(check func(context.Context) bool) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
if check != nil {
if !check(r.Context()) {
w.WriteHeader(http.StatusInternalServerError)
}
}
w.WriteHeader(http.StatusOK)
}
}