1
0
Fork 0
mirror of https://github.com/kyverno/kyverno.git synced 2024-12-15 17:51:20 +00:00
kyverno/pkg/webhooks/handlers/probe.go
Charles-Edouard Brétéché 6e813a6b9e
refactor: webhooks package (#3516)
* refactor: use more policy interface

Signed-off-by: Charles-Edouard Brétéché <charled.breteche@gmail.com>

* refactor: migrate to policy interface

Signed-off-by: Charles-Edouard Brétéché <charled.breteche@gmail.com>

* refactor: webhooks package

Signed-off-by: Charles-Edouard Brétéché <charled.breteche@gmail.com>
2022-03-31 23:34:10 +08:00

14 lines
292 B
Go

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