Documentation ¶
Overview ¶
Package liveness implements Kubernetes health checks for the controller. The health checks affect whether the controller is considered alive or dead (in which case it is restarted).
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ActivityName ¶ added in v1.2.5
type ActivityName int
ActivityName represents the actions of the controller which are monitored by the health checks.
const ( // Undefined indicates a default action. Undefined ActivityName = iota // SynchronizeAll indicates a Controller.SynchronizeAll() call. SynchronizeAll // McrtResyncProcess indicates a ManagedCertificate object is // processed by the lower priority queue in the controller. McrtResyncProcess // IngressResyncProcess indicates an Ingress object is processed by // the lower priority queue in the controller. IngressResyncProcess )
type HealthCheck ¶
type HealthCheck struct {
// contains filtered or unexported fields
}
HealthCheck implements an HTTP endpoint through which it communicates the liveness status of the controller by responding with 2xx HTTP codes when the controller is alive and with 5xx HTTP codes when it is dead.
HealthCheck tracks the last time of when the following actions were performed by the controller and when they succeeded: - SynchronizeAll: Add all known resources to the controller queues. - McrtResyncProcess, IngressResyncProcess: process ManagedCertificate or Ingress, respectively, on a low priority workqueue.
- If the last time SynchronizeAll was performed or succeeded is too far ago, HealthCheck will respond that the controller is dead. - If an Ingress or a ManagedCertificate resource was queued for processing by the *previous* SynchronizeAll call and was not processed until `syncSuccessTimeout` elapses, HealthCheck will respond that the controller is dead. - If health checking is not running, it always responds that the controller is alive. It is not running by default.
func NewHealthCheck ¶
func NewHealthCheck(healthCheckInterval, activityTimeout, successTimeout time.Duration) *HealthCheck
NewHealthCheck builds new HealthCheck object with given timeout.
func (*HealthCheck) Start ¶ added in v1.2.5
func (hc *HealthCheck) Start(endpointAddress, endpointPath string)
Start starts controller health checks and the liveness probe http server. It runs the health checks every healthCheckInterval until Stop() is called.
func (*HealthCheck) Stop ¶ added in v1.2.5
func (hc *HealthCheck) Stop() error
Stop stops controller health checks and the liveness probe http server.
func (*HealthCheck) UpdateLastActivity ¶ added in v1.2.5
func (hc *HealthCheck) UpdateLastActivity(activityName ActivityName, timestamp time.Time)
UpdateLastActivity updates last time of an activity.
func (*HealthCheck) UpdateLastSuccessSync ¶ added in v1.2.5
func (hc *HealthCheck) UpdateLastSuccessSync(timestamp time.Time, ingressScheduled, mcrtScheduled bool)
UpdateLastSuccessSync updates last time of successful (i.e. not ending in error) Controller.synchronizeAll activity.
Directories ¶
Path | Synopsis |
---|---|
Package testhelpers defines helpers for liveness package.
|
Package testhelpers defines helpers for liveness package. |