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 ¶
const ( HealthcheckPrefix = "check-" HealthcheckTag = "tag:healthcheck-tag" HealthcheckTagValue = "healthcheck" HealthcheckNetworkProperty = "network.healthcheck" )
const CellUnhealthyMetric = "CellUnhealthy"
const GardenHealthCheckFailedMetric = "GardenHealthCheckFailed"
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Checker ¶
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 ¶
func (HealthcheckTimeoutError) Error() string
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 ¶
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.
Startup behaviour: the ready signal is closed immediately so the ordered ifrit group proceeds to start http_server (and /ping) without waiting for the first garden healthcheck (~60-90s container creation overhead on a fresh VM). BOSH post-start therefore completes in ~14s.
During the initial healthcheck phase, transient errors (e.g. garden not yet ready because rep and garden start simultaneously during a BOSH upgrade) cause a retry rather than a fatal exit. The cell is marked unhealthy on each failure so BBS does not schedule LRPs there. Only a timeout of the full GardenHealthcheckTimeout (default 10m) is treated as a fatal error, ensuring permanently broken garden is still detected without triggering a crash-restart loop on every upgrade. Once the initial healthcheck succeeds, periodic failures are handled with the same retry-until-timeout resilience, preserving runtime stability.
type UnrecoverableError ¶
type UnrecoverableError string
func (UnrecoverableError) Error ¶
func (e UnrecoverableError) Error() string