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 ¶
type HTTPServer interface { // Server is designed so that http.Server satifies this interface, Serve(listener net.Listener) error }
HTTPServer allows for testing of Server.
type HTTPServerFactory ¶
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 ¶
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 ¶
func NewDefaultHealthzServer(addr string, healthTimeout time.Duration) *HealthzServer
NewDefaultHealthzServer returns a default healthz http server.
func (*HealthzServer) Run ¶
func (hs *HealthzServer) Run()
Run starts the healthz http server and returns.
func (*HealthzServer) UpdateTimestamp ¶
func (hs *HealthzServer) UpdateTimestamp()
UpdateTimestamp updates the lastUpdated timestamp.
type HealthzUpdater ¶
type HealthzUpdater interface {
UpdateTimestamp()
}
HealthzUpdater allows callers to update healthz timestamp only.
type Listener ¶
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 ¶
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".
func NewServer ¶
func NewServer(hostname string, recorder record.EventRecorder, listener Listener, httpServerFactory HTTPServerFactory) Server
NewServer allocates a new healthcheck server manager. If either of the injected arguments are nil, defaults will be used.