in plugin/healthz.go [85:115]
func (m *HealthCheckerManager) HandlerFunc(w http.ResponseWriter, r *http.Request) {
ctx, cancel := context.WithTimeout(r.Context(), m.callTimeout)
defer cancel()
conn, err := dialUnix(m.unixSocketPath)
if err != nil {
http.Error(w, err.Error(), http.StatusServiceUnavailable)
return
}
defer conn.Close()
if err := m.plugin.PingRPC(ctx, conn); err != nil {
http.Error(w, err.Error(), http.StatusServiceUnavailable)
return
}
if err := m.TestIAMPermissions(); err != nil {
http.Error(w, err.Error(), http.StatusForbidden)
return
}
if r.FormValue("ping-kms") == "true" {
if err := m.plugin.PingKMS(ctx, conn); err != nil {
http.Error(w, err.Error(), http.StatusServiceUnavailable)
return
}
}
w.WriteHeader(http.StatusOK)
w.Write([]byte("ok"))
}