gardenhealth

package
v0.0.0-...-3868529 Latest Latest
Warning

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

Go to latest
Published: Apr 8, 2024 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Overview

Package gardenhealth contains logic to periodically verify that basic garden container functionality is working.

gardenhealth.Checker is responsible for executing the healthcheck operation. gardenhealth.Runner manages the running of the checker and is responsible for communicating health to the executor.

For more details, see the Runner and Checker documentation in this package.

Index

Constants

View Source
const (
	HealthcheckPrefix          = "check-"
	HealthcheckTag             = "tag:healthcheck-tag"
	HealthcheckTagValue        = "healthcheck"
	HealthcheckNetworkProperty = "network.healthcheck"
)
View Source
const CellUnhealthyMetric = "CellUnhealthy"
View Source
const GardenHealthCheckFailedMetric = "GardenHealthCheckFailed"

Variables

This section is empty.

Functions

This section is empty.

Types

type Checker

type Checker interface {
	Healthcheck(lager.Logger) error
	Cancel(lager.Logger)
}

func NewChecker

func NewChecker(
	rootFSPath string,
	containerOwnerName string,
	retryInterval time.Duration,
	healthcheckSpec garden.ProcessSpec,
	gardenClient garden.Client,
	guidGenerator guidgen.Generator,
) Checker

NewChecker constructs a checker.

healthcheckSpec describes the process to run in the healthcheck container and retryInterval describes the amount of time to wait to sleep when retrying a failed garden command.

type HealthcheckFailedError

type HealthcheckFailedError int

func (HealthcheckFailedError) Error

func (e HealthcheckFailedError) Error() string

type HealthcheckTimeoutError

type HealthcheckTimeoutError struct{}

func (HealthcheckTimeoutError) Error

type Runner

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

Runner coordinates health checks against an executor client. When checks fail or time out, its executor will be marked as unhealthy until a successful check occurs.

See NewRunner and Runner.Run for more details.

func NewRunner

func NewRunner(
	checkInterval time.Duration,
	emissionInterval time.Duration,
	timeoutInterval time.Duration,
	logger lager.Logger,
	checker Checker,
	executorClient executor.Client,
	metronClient loggingclient.IngressClient,
	clock clock.Clock,
) *Runner

NewRunner constructs a healthcheck runner.

The checkInterval parameter controls how often the healthcheck should run, and the timeoutInterval sets the time to wait for the healthcheck to complete before marking the executor as unhealthy.

func (*Runner) Run

func (r *Runner) Run(signals <-chan os.Signal, ready chan<- struct{}) error

Run coordinates the execution of the healthcheck. It responds to incoming signals, monitors the elapsed time to determine timeouts, and ensures the healthcheck runs periodically.

Note: If the healthcheck has not returned before the timeout expires, we intentionally do not kill the healthcheck process, and we don't spawn a new healthcheck until the existing healthcheck exits. It may be necessary for an operator to inspect the long running container to debug the problem.

type UnrecoverableError

type UnrecoverableError string

func (UnrecoverableError) Error

func (e UnrecoverableError) Error() string

Directories

Path Synopsis
Code generated by counterfeiter.
Code generated by counterfeiter.

Jump to

Keyboard shortcuts

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