mirror of
https://github.com/kyverno/kyverno.git
synced 2024-12-14 11:57:48 +00:00
f2bfc13edb
Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>
17 lines
315 B
Go
17 lines
315 B
Go
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)
|
|
}
|
|
}
|