mirror of
https://github.com/kubernetes-sigs/prometheus-adapter.git
synced 2026-04-07 22:25:03 +00:00
vendor: revendor
This commit is contained in:
parent
269295a414
commit
9f0440be0f
669 changed files with 58447 additions and 20021 deletions
13
vendor/k8s.io/apiserver/pkg/server/healthz/healthz.go
generated
vendored
13
vendor/k8s.io/apiserver/pkg/server/healthz/healthz.go
generated
vendored
|
|
@ -161,6 +161,7 @@ func InstallPathHandler(mux mux, path string, checks ...HealthChecker) {
|
|||
|
||||
klog.V(5).Infof("Installing health checkers for (%v): %v", path, formatQuoted(checkerNames(checks...)...))
|
||||
|
||||
name := strings.Split(strings.TrimPrefix(path, "/"), "/")[0]
|
||||
mux.Handle(path,
|
||||
metrics.InstrumentHandlerFunc("GET",
|
||||
/* group = */ "",
|
||||
|
|
@ -171,7 +172,7 @@ func InstallPathHandler(mux mux, path string, checks ...HealthChecker) {
|
|||
/* component = */ "",
|
||||
/* deprecated */ false,
|
||||
/* removedRelease */ "",
|
||||
handleRootHealthz(checks...)))
|
||||
handleRootHealth(name, checks...)))
|
||||
for _, check := range checks {
|
||||
mux.Handle(fmt.Sprintf("%s/%v", path, check.Name()), adaptCheckToHandler(check.Check))
|
||||
}
|
||||
|
|
@ -207,8 +208,8 @@ func getExcludedChecks(r *http.Request) sets.String {
|
|||
return sets.NewString()
|
||||
}
|
||||
|
||||
// handleRootHealthz returns an http.HandlerFunc that serves the provided checks.
|
||||
func handleRootHealthz(checks ...HealthChecker) http.HandlerFunc {
|
||||
// handleRootHealth returns an http.HandlerFunc that serves the provided checks.
|
||||
func handleRootHealth(name string, checks ...HealthChecker) http.HandlerFunc {
|
||||
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||
excluded := getExcludedChecks(r)
|
||||
// failedVerboseLogOutput is for output to the log. It indicates detailed failed output information for the log.
|
||||
|
|
@ -240,8 +241,8 @@ func handleRootHealthz(checks ...HealthChecker) http.HandlerFunc {
|
|||
}
|
||||
// always be verbose on failure
|
||||
if len(failedChecks) > 0 {
|
||||
klog.V(2).Infof("healthz check failed: %s\n%v", strings.Join(failedChecks, ","), failedVerboseLogOutput.String())
|
||||
http.Error(httplog.Unlogged(r, w), fmt.Sprintf("%shealthz check failed", individualCheckOutput.String()), http.StatusInternalServerError)
|
||||
klog.V(2).Infof("%s check failed: %s\n%v", strings.Join(failedChecks, ","), name, failedVerboseLogOutput.String())
|
||||
http.Error(httplog.Unlogged(r, w), fmt.Sprintf("%s%s check failed", individualCheckOutput.String(), name), http.StatusInternalServerError)
|
||||
return
|
||||
}
|
||||
|
||||
|
|
@ -253,7 +254,7 @@ func handleRootHealthz(checks ...HealthChecker) http.HandlerFunc {
|
|||
}
|
||||
|
||||
individualCheckOutput.WriteTo(w)
|
||||
fmt.Fprint(w, "healthz check passed\n")
|
||||
fmt.Fprintf(w, "%s check passed\n", name)
|
||||
})
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue