Documentation ¶
Overview ¶
Package healthz implements basic http server health checking. Usage:
import "k8s.io/apiserver/pkg/server/healthz" healthz.DefaultHealthz()
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DefaultHealthz ¶
func DefaultHealthz(checks ...HealthzChecker)
DefaultHealthz installs the default healthz check to the http.DefaultServeMux.
func Hash ¶
func Hash(certificate *x509.Certificate) string
Hash calculates the SHA-256 hash of the Subject Public Key Information (SPKI) object in an x509 certificate (in DER encoding). It returns the full hash as a hex encoded string (suitable for passing to Set.Allow).
func InstallHandler ¶
func InstallHandler(mux mux, checks ...HealthzChecker)
InstallHandler registers handlers for health checking on the path "/healthz" to mux. *All handlers* for mux must be specified in exactly one call to InstallHandler. Calling InstallHandler more than once for the same mux will result in a panic.
func InstallPathHandler ¶
func InstallPathHandler(mux mux, path string, checks ...HealthzChecker)
InstallPathHandler registers handlers for health checking on a specific path to mux. *All handlers* for the path must be specified in exactly one call to InstallPathHandler. Calling InstallPathHandler more than once for the same path and mux will result in a panic.
Types ¶
type HealthzChecker ¶
HealthzChecker is a named healthz checker.
var LogHealthz HealthzChecker = &log{}
LogHealthz returns true if logging is not blocked
var PingHealthz HealthzChecker = ping{}
PingHealthz returns true automatically when checked
func NamedCheck ¶
func NamedCheck(name string, check func(r *http.Request) error) HealthzChecker
NamedCheck returns a healthz checker for the given name and function.
func NewCertHealthz ¶
func NewCertHealthz(certFile string) (HealthzChecker, error)
CertHealthz returns true if tls.crt is unchanged when checked