Documentation
¶
Overview ¶
Package healthcheck provides tools for serving kube-proxy healthchecks.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type HTTPServer ¶ added in v1.6.2
type HTTPServer interface {
// Server is designed so that http.Server satisfies this interface,
Serve(listener net.Listener) error
}
HTTPServer allows for testing of Server.
type HTTPServerFactory ¶ added in v1.6.2
type HTTPServerFactory interface {
// New creates an instance of a type satisfying HTTPServer. This is
// designed to include http.Server.
New(addr string, handler http.Handler) HTTPServer
}
HTTPServerFactory allows for testing of Server. If the HTTPServerFactory argument to NewServer() is nil, the real http.Server type will be used.
type HealthzServer ¶ added in v1.7.0
type HealthzServer struct {
// contains filtered or unexported fields
}
HealthzServer returns 200 "OK" by default. Once timestamp has been updated, it verifies we don't exceed max no respond duration since last update.
func NewDefaultHealthzServer ¶ added in v1.7.0
func NewDefaultHealthzServer(addr string, healthTimeout time.Duration, recorder record.EventRecorder, nodeRef *v1.ObjectReference) *HealthzServer
NewDefaultHealthzServer returns a default healthz http server.
func (*HealthzServer) Run ¶ added in v1.7.0
func (hs *HealthzServer) Run()
Run starts the healthz http server and returns.
func (*HealthzServer) UpdateTimestamp ¶ added in v1.7.0
func (hs *HealthzServer) UpdateTimestamp()
UpdateTimestamp updates the lastUpdated timestamp.
type HealthzUpdater ¶ added in v1.7.0
type HealthzUpdater interface {
UpdateTimestamp()
}
HealthzUpdater allows callers to update healthz timestamp only.
type Listener ¶ added in v1.6.2
type Listener interface {
// Listen is very much like net.Listen, except the first arg (network) is
// fixed to be "tcp".
Listen(addr string) (net.Listener, error)
}
Listener allows for testing of Server. If the Listener argument to NewServer() is nil, the real net.Listen function will be used.
type Server ¶ added in v1.6.2
type Server interface {
// Make the new set of services be active. Services that were open before
// will be closed. Services that are new will be opened. Service that
// existed and are in the new set will be left alone. The value of the map
// is the healthcheck-port to listen on.
SyncServices(newServices map[types.NamespacedName]uint16) error
// Make the new set of endpoints be active. Endpoints for services that do
// not exist will be dropped. The value of the map is the number of
// endpoints the service has on this node.
SyncEndpoints(newEndpoints map[types.NamespacedName]int) error
}
Server serves HTTP endpoints for each service name, with results based on the endpoints. If there are 0 endpoints for a service, it returns a 503 "Service Unavailable" error (telling LBs not to use this node). If there are 1 or more endpoints, it returns a 200 "OK".