Documentation ¶
Overview ¶
Package handlers holds useful HTTP handler implementations.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var Error = network.ErrorHandler
Error sets up a handler suitable for use with the ErrorHandler field on httputil's reverse proxy, which logs /proc/net/sockstat data.
Functions ¶
This section is empty.
Types ¶
type Drainer ¶
type Drainer struct { // Mutex guards the initialization and resets of the timer sync.RWMutex // HealthCheck is an optional health check that is performed until the drain signal is received. // When unspecified, a "200 OK" is returned, otherwise this function is invoked. HealthCheck http.HandlerFunc // Inner is the http.Handler to which we delegate actual requests. Inner http.Handler // QuietPeriod is the duration that must elapse without any requests // after Drain is called before it may return. QuietPeriod time.Duration // HealthCheckUAPrefixes are the additional user agent prefixes that trigger the // drainer's health check HealthCheckUAPrefixes []string // contains filtered or unexported fields }
Drainer wraps an inner http.Handler to support responding to kubelet probes and KProbes with a "200 OK" until the handler is told to Drain, or Drainer will optionally run the HealthCheck if it is defined. When the Drainer is told to Drain, it will immediately start to fail probes with a "500 shutting down", and the call will block until no requests have been received for QuietPeriod (defaults to network.DefaultDrainTimeout).
func (*Drainer) Drain ¶
func (d *Drainer) Drain()
Drain blocks until QuietPeriod has elapsed since the last request, starting when this is invoked.