healthcheck

package
v1.6.7 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 5, 2017 License: Apache-2.0 Imports: 11 Imported by: 0

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 satifies 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 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".

func NewServer added in v1.6.2

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL