health

package
v0.24.1 Latest Latest
Warning

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

Go to latest
Published: Sep 3, 2021 License: Apache-2.0 Imports: 13 Imported by: 12

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HTTPProbe added in v0.8.0

func HTTPProbe(config HTTPProbeConfigOptions) error

HTTPProbe checks that HTTP connection can be established to the address.

func IsHTTPProbeReady added in v0.8.0

func IsHTTPProbeReady(res *http.Response) bool

IsHTTPProbeReady checks whether we received a successful Response

func IsHTTPProbeShuttingDown added in v0.16.0

func IsHTTPProbeShuttingDown(res *http.Response) bool

IsHTTPProbeShuttingDown checks whether the Response indicates the prober is shutting down.

func IsHTTPProbeUpgradingToH2C added in v0.22.0

func IsHTTPProbeUpgradingToH2C(res *http.Response) bool

IsHTTPProbeUpgradingToH2C checks whether the server indicates it's switching to h2c protocol.

func ProbeHandler added in v0.19.0

func ProbeHandler(healthState *State, prober func() bool, isAggressive bool, tracingEnabled bool, next http.Handler) http.HandlerFunc

ProbeHandler returns a http.HandlerFunc that responds to health checks if the knative network probe header is passed, and otherwise delegates to the next handler.

func TCPProbe

func TCPProbe(config TCPProbeConfigOptions) error

TCPProbe checks that a TCP socket to the address can be opened. Did not reuse k8s.io/kubernetes/pkg/probe/tcp to not create a dependency on klog.

Types

type HTTPProbeConfigOptions added in v0.8.0

type HTTPProbeConfigOptions struct {
	Timeout time.Duration
	*corev1.HTTPGetAction
	KubeMajor     string
	KubeMinor     string
	MaxProtoMajor int
}

HTTPProbeConfigOptions holds the HTTP probe config options

type State

type State struct {
	// contains filtered or unexported fields
}

State holds state about the current healthiness of the component.

func NewState added in v0.21.0

func NewState() *State

NewState returns a new State with both alive and shuttingDown set to false.

func (*State) DrainHandlerFunc added in v0.10.0

func (h *State) DrainHandlerFunc() func(_ http.ResponseWriter, _ *http.Request)

DrainHandlerFunc constructs an HTTP handler that waits until the proxy server is shut down.

func (*State) HandleHealthProbe added in v0.10.0

func (h *State) HandleHealthProbe(prober func() bool, isAggressive bool, w http.ResponseWriter)

HandleHealthProbe handles the probe according to the current state of the health server. If isAggressive is false and prober has succeeded previously, the function returns success without probing user-container again (until shutdown).

func (*State) Shutdown added in v0.5.0

func (h *State) Shutdown(drain func())

Shutdown marks the proxy server as not ready and begins its shutdown process. This results in unblocking any connections waiting for drain.

type TCPProbeConfigOptions added in v0.8.0

type TCPProbeConfigOptions struct {
	SocketTimeout time.Duration
	Address       string
}

TCPProbeConfigOptions holds the TCP probe config options

Jump to

Keyboard shortcuts

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