healthz

package
v0.19.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 13, 2024 License: Apache-2.0 Imports: 7 Imported by: 4,623

Documentation

Overview

Package healthz contains helpers from supporting liveness and readiness endpoints. (often referred to as healthz and readyz, respectively).

This package draws heavily from the apiserver's healthz package ( https://github.com/kubernetes/apiserver/tree/master/pkg/server/healthz ) but has some changes to bring it in line with controller-runtime's style.

The main entrypoint is the Handler -- this serves both aggregated health status and individual health check endpoints.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CheckHandler

type CheckHandler struct {
	Checker
}

CheckHandler is an http.Handler that serves a health check endpoint at the root path, based on its checker.

func (CheckHandler) ServeHTTP

func (h CheckHandler) ServeHTTP(resp http.ResponseWriter, req *http.Request)

type Checker

type Checker func(req *http.Request) error

Checker knows how to perform a health check.

var Ping Checker = func(_ *http.Request) error { return nil }

Ping returns true automatically when checked.

type Handler

type Handler struct {
	Checks map[string]Checker
}

Handler is an http.Handler that aggregates the results of the given checkers to the root path, and supports calling individual checkers on subpaths of the name of the checker.

Adding checks on the fly is *not* threadsafe -- use a wrapper.

func (*Handler) ServeHTTP

func (h *Handler) ServeHTTP(resp http.ResponseWriter, req *http.Request)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL