Documentation
¶
Overview ¶
Package healthcheck provides tools for serving kube-proxy healthchecks.
Index ¶
- Constants
- type FakeServiceHealthServer
- type ProxierHealth
- type ProxyHealth
- type ProxyHealthServer
- func (hs *ProxyHealthServer) Health() ProxyHealth
- func (hs *ProxyHealthServer) NodeEligible() bool
- func (hs *ProxyHealthServer) QueuedUpdate(ipFamily v1.IPFamily)
- func (hs *ProxyHealthServer) Run(ctx context.Context) error
- func (hs *ProxyHealthServer) SyncNode(node *v1.Node)
- func (hs *ProxyHealthServer) 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 ProxierHealth ¶ added in v1.33.0
type ProxierHealth struct { LastUpdated time.Time `json:"lastUpdated"` Healthy bool `json:"healthy"` }
ProxierHealth represents the health of a proxier which operates on a single IP family.
type ProxyHealth ¶ added in v1.33.0
type ProxyHealth struct { // LastUpdated is the last updated time of the proxier // which was updated most recently. // This is kept for backward-compatibility. LastUpdated time.Time `json:"lastUpdated"` CurrentTime time.Time `json:"currentTime"` NodeEligible *bool `json:"nodeEligible,omitempty"` // Healthy is true when all the proxiers are healthy, // false otherwise. Healthy bool `json:"healthy"` // status of the health check per IP family Status map[v1.IPFamily]ProxierHealth `json:"status,omitempty"` }
ProxyHealth represents the health of kube-proxy, embeds health of individual proxiers.
type ProxyHealthServer ¶ added in v1.33.0
type ProxyHealthServer struct {
// contains filtered or unexported fields
}
ProxyHealthServer 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 NewProxyHealthServer ¶ added in v1.33.0
func NewProxyHealthServer(addr string, healthTimeout time.Duration) *ProxyHealthServer
NewProxyHealthServer returns a proxy health http server.
func (*ProxyHealthServer) Health ¶ added in v1.33.0
func (hs *ProxyHealthServer) Health() ProxyHealth
Health returns proxy health status.
func (*ProxyHealthServer) NodeEligible ¶ added in v1.33.0
func (hs *ProxyHealthServer) NodeEligible() bool
NodeEligible returns nodeEligible field of ProxyHealthServer.
func (*ProxyHealthServer) QueuedUpdate ¶ added in v1.33.0
func (hs *ProxyHealthServer) 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 (*ProxyHealthServer) Run ¶ added in v1.33.0
func (hs *ProxyHealthServer) Run(ctx context.Context) error
Run starts the healthz HTTP server and blocks until it exits.
func (*ProxyHealthServer) SyncNode ¶ added in v1.33.0
func (hs *ProxyHealthServer) 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 (*ProxyHealthServer) Updated ¶ added in v1.33.0
func (hs *ProxyHealthServer) 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(nodeName string, recorder events.EventRecorder, nodePortAddresses *proxyutil.NodePortAddresses, healthzServer proxyHealthChecker) ServiceHealthServer
NewServiceHealthServer allocates a new service healthcheck server manager