Documentation ¶
Overview ¶
Package healthcheck provides tools for serving kube-proxy healthchecks.
Index ¶
- Constants
- type FakeServiceHealthServer
- type ProxierHealthServer
- func (hs *ProxierHealthServer) IsHealthy() bool
- func (hs *ProxierHealthServer) NodeEligible() bool
- func (hs *ProxierHealthServer) QueuedUpdate(ipFamily v1.IPFamily)
- func (hs *ProxierHealthServer) Run(ctx context.Context) error
- func (hs *ProxierHealthServer) SyncNode(node *v1.Node)
- func (hs *ProxierHealthServer) Updated(ipFamily v1.IPFamily)
- type ServiceHealthServer
Constants ¶
const ( // ToBeDeletedTaint is a taint used by the CLuster Autoscaler before marking a node for deletion. Defined in // https://github.com/kubernetes/autoscaler/blob/e80ab518340f88f364fe3ef063f8303755125971/cluster-autoscaler/utils/deletetaint/delete.go#L36 ToBeDeletedTaint = "ToBeDeletedByClusterAutoscaler" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type FakeServiceHealthServer ¶ added in v1.17.0
type FakeServiceHealthServer struct{}
FakeServiceHealthServer is a fake ServiceHealthServer for test programs
func (FakeServiceHealthServer) SyncEndpoints ¶ added in v1.17.0
func (fake FakeServiceHealthServer) SyncEndpoints(_ map[types.NamespacedName]int) error
SyncEndpoints is part of ServiceHealthServer
func (FakeServiceHealthServer) SyncServices ¶ added in v1.17.0
func (fake FakeServiceHealthServer) SyncServices(_ map[types.NamespacedName]uint16) error
SyncServices is part of ServiceHealthServer
type ProxierHealthServer ¶ added in v1.17.0
type ProxierHealthServer struct {
// contains filtered or unexported fields
}
ProxierHealthServer allows callers to:
- run a http server with /healthz and /livez endpoint handlers.
- update healthz timestamps before and after synchronizing dataplane.
- sync node status, for reporting unhealthy /healthz response if the node is marked for deletion by autoscaler.
- get proxy health by verifying that the delay between QueuedUpdate() calls and Updated() calls exceeded healthTimeout or not.
func NewProxierHealthServer ¶ added in v1.17.0
func NewProxierHealthServer(addr string, healthTimeout time.Duration) *ProxierHealthServer
NewProxierHealthServer returns a proxier health http server.
func (*ProxierHealthServer) IsHealthy ¶ added in v1.29.0
func (hs *ProxierHealthServer) IsHealthy() bool
IsHealthy returns only the proxier's health state, following the same definition the HTTP server defines, but ignoring the state of the Node.
func (*ProxierHealthServer) NodeEligible ¶ added in v1.29.0
func (hs *ProxierHealthServer) NodeEligible() bool
NodeEligible returns nodeEligible field of ProxierHealthServer.
func (*ProxierHealthServer) QueuedUpdate ¶ added in v1.17.0
func (hs *ProxierHealthServer) QueuedUpdate(ipFamily v1.IPFamily)
QueuedUpdate should be called when the proxier receives a Service or Endpoints event from API Server containing information that requires updating service rules. It indicates that the proxier for the given IP family has received changes but has not yet pushed them to its backend. If the proxier does not call Updated within the healthTimeout time then it will be considered unhealthy.
func (*ProxierHealthServer) Run ¶ added in v1.17.0
func (hs *ProxierHealthServer) Run(ctx context.Context) error
Run starts the healthz HTTP server and blocks until it exits.
func (*ProxierHealthServer) SyncNode ¶ added in v1.29.0
func (hs *ProxierHealthServer) SyncNode(node *v1.Node)
SyncNode syncs the node and determines if it is eligible or not. Eligible is defined as being: not tainted by ToBeDeletedTaint and not deleted.
func (*ProxierHealthServer) Updated ¶ added in v1.17.0
func (hs *ProxierHealthServer) Updated(ipFamily v1.IPFamily)
Updated should be called when the proxier of the given IP family has successfully updated the service rules to reflect the current state and should be considered healthy now.
type ServiceHealthServer ¶ added in v1.17.0
type ServiceHealthServer 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 }
ServiceHealthServer 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 NewFakeServiceHealthServer ¶ added in v1.17.0
func NewFakeServiceHealthServer() ServiceHealthServer
NewFakeServiceHealthServer allocates a new fake service healthcheck server manager
func NewServiceHealthServer ¶ added in v1.17.0
func NewServiceHealthServer(hostname string, recorder events.EventRecorder, nodePortAddresses *proxyutil.NodePortAddresses, healthzServer proxierHealthChecker) ServiceHealthServer
NewServiceHealthServer allocates a new service healthcheck server manager