Documentation ¶
Overview ¶
Package health contains utilities for health checking, as well as health status information.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type HTTPGetInterface ¶
HTTPGetInterface is an abstract interface for testability. It abstracts the interface of http.Client.Get.
type HTTPHealthChecker ¶
type HTTPHealthChecker struct {
// contains filtered or unexported fields
}
HTTPHealthChecker is an implementation of HealthChecker which checks container health by sending HTTP Get requests.
func (*HTTPHealthChecker) HealthCheck ¶
func (h *HTTPHealthChecker) HealthCheck(container api.Container) (Status, error)
HealthCheck checks if the container is healthy by trying sending HTTP Get requests to the container.
type HealthChecker ¶
HealthChecker defines an abstract interface for checking container health.
func NewHealthChecker ¶
func NewHealthChecker() HealthChecker
NewHealthChecker creates a new HealthChecker which supports multiple types of liveness probes.
type MuxHealthChecker ¶
type MuxHealthChecker struct {
// contains filtered or unexported fields
}
MuxHealthChecker bundles multiple implementations of HealthChecker of different types.
func (*MuxHealthChecker) HealthCheck ¶
func (m *MuxHealthChecker) HealthCheck(container api.Container) (Status, error)
HealthCheck delegates the health-checking of the container to one of the bundled implementations. It chooses an implementation according to container.LivenessProbe.Type. If there is no matching health checker it returns Unknown, nil.
type Status ¶
type Status int
Status takes only one of values of these constants.
func Check ¶
func Check(url string, client HTTPGetInterface) (Status, error)
Check checks if a GET request to the url succeeds. If the HTTP response code is successful (i.e. 400 > code >= 200), it returns Healthy. If the HTTP response code is unsuccessful, it returns Unhealthy. It returns Unknown and err if the HTTP communication itself fails.