Documentation ¶
Index ¶
- Constants
- func GlobalOverride(name string) *time.Duration
- func SetGlobalTimeoutOverrides(overrides map[string]time.Duration)
- type HealthAggregator
- func (aggregator *HealthAggregator) RegisterReporter(name string, reports *HealthReport, timeout time.Duration)
- func (aggregator *HealthAggregator) Report(name string, report *HealthReport)
- func (aggregator *HealthAggregator) ServeHTTP(enabled bool, host string, port int)
- func (aggregator *HealthAggregator) Summary() *HealthReport
- type HealthReport
Constants ¶
const ( // The HTTP status that we use for 'ready' or 'live', with detail content. (Kubernetes // interprets any 200<=status<400 as 'good'.) StatusGood = 200 // The HTTP status that we use for 'ready' or 'live', without any detail content. 204 means // "No Content: The server successfully processed the request and is not returning any // content." (Kubernetes interprets any 200<=status<400 as 'good'.) StatusGoodNoContent = 204 // The HTTP status that we use for 'not ready' or 'not live'. 503 means "Service // Unavailable: The server is currently unavailable (because it is overloaded or down for // maintenance). Generally, this is a temporary state." (Kubernetes interprets any // status>=400 as 'bad'.) StatusBad = 503 )
Variables ¶
This section is empty.
Functions ¶
func GlobalOverride ¶
Types ¶
type HealthAggregator ¶
type HealthAggregator struct {
// contains filtered or unexported fields
}
A HealthAggregator receives health reports from individual reporters (which are typically components of a particular daemon or application) and aggregates them into an overall health summary. For each monitored kind of health, all of the reporters that report that need to say that it is good; for example, to be 'ready' overall, all of the reporters that report readiness need to have recently said 'Ready: true'.
func NewHealthAggregator ¶
func NewHealthAggregator() *HealthAggregator
func (*HealthAggregator) RegisterReporter ¶
func (aggregator *HealthAggregator) RegisterReporter(name string, reports *HealthReport, timeout time.Duration)
RegisterReporter registers a reporter with a HealthAggregator. The aggregator uses NAME to identify the reporter. REPORTS indicates the kinds of health that this reporter will report. TIMEOUT is the expiry time for this reporter's reports; the implication of which is that the reporter should normally refresh its reports well before this time has expired.
func (*HealthAggregator) Report ¶
func (aggregator *HealthAggregator) Report(name string, report *HealthReport)
Report reports current health from a reporter to a HealthAggregator. NAME is the reporter's name and REPORTS conveys the current status, for each kind of health that the reporter said it was going to report when it called RegisterReporter.
func (*HealthAggregator) ServeHTTP ¶
func (aggregator *HealthAggregator) ServeHTTP(enabled bool, host string, port int)
ServeHTTP publishes the current overall liveness and readiness at http://HOST:PORT/liveness and http://HOST:PORT/readiness respectively. A GET request on those URLs returns StatusGood or StatusBad, according to the current overall liveness or readiness. These endpoints are designed for use by Kubernetes liveness and readiness probes.
func (*HealthAggregator) Summary ¶
func (aggregator *HealthAggregator) Summary() *HealthReport
Summary calculates the current overall health for a HealthAggregator.
type HealthReport ¶
The HealthReport struct has slots for the levels of health that we monitor and aggregate.
func (*HealthReport) String ¶
func (h *HealthReport) String() string