Documentation ¶
Index ¶
- Constants
- type HealthCheck
- func (hc *HealthCheck) Protocol() annotations.AppProtocol
- func (hc *HealthCheck) ToAlphaComputeHealthCheck() *computealpha.HealthCheck
- func (hc *HealthCheck) ToBetaComputeHealthCheck() (*computebeta.HealthCheck, error)
- func (hc *HealthCheck) ToComputeHealthCheck() (*compute.HealthCheck, error)
- func (hc *HealthCheck) Version() meta.Version
- type HealthCheckProvider
- type HealthChecker
- type HealthChecks
Constants ¶
const ( // These values set a low health threshold and a high failure threshold. // We're just trying to detect if the node networking is // borked, service level outages will get detected sooner // by kube-proxy. // DefaultHealthCheckInterval defines how frequently a probe runs with IG backends DefaultHealthCheckInterval = 60 * time.Second // DefaultNEGHealthCheckInterval defines how frequently a probe runs with NEG backends DefaultNEGHealthCheckInterval = 15 * time.Second // DefaultHealthyThreshold defines the threshold of success probes that declare a backend "healthy" DefaultHealthyThreshold = 1 // DefaultUnhealthyThreshold defines the threshold of failure probes that declare a instance "unhealthy" DefaultUnhealthyThreshold = 10 // DefaultNEGUnhealthyThreshold defines the threshold of failure probes that declare a network endpoint "unhealthy" // In NEG mode, cloud loadbalancer health check request will no longer be loadbalanced by kube-proxy(iptables). // Instead, health checks can reach endpoints directly. Hence the loadbalancer health check can get a clear signal // of endpoint health status. As a result, we are able to tune down the unhealthy threshold to 2. DefaultNEGUnhealthyThreshold = 2 // DefaultTimeout defines the timeout of each probe for IG DefaultTimeout = 60 * time.Second // DefaultTimeout defines the timeout of each probe for NEG DefaultNEGTimeout = 15 * time.Second // This is a constant for GCE API. // USE_SERVING_PORT: For NetworkEndpointGroup, the port specified for // each network endpoint is used for health checking. For other // backends, the port or named port specified in the Backend Service is // used for health checking. UseServingPortSpecification = "USE_SERVING_PORT" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type HealthCheck ¶
type HealthCheck struct { computealpha.HTTPHealthCheck computealpha.HealthCheck //compositeHealthCheck composite.HealthCheck ForNEG bool // contains filtered or unexported fields }
HealthCheck embeds two types - the generic healthcheck compute.HealthCheck and the HTTP settings compute.HTTPHealthCheck. By embedding both, consumers can modify all relevant settings (HTTP specific and HealthCheck generic) regardless of Type Consumers should call .Out() func to generate a compute.HealthCheck with the proper child struct (.HttpHealthCheck, .HttpshealthCheck, etc).
func DefaultHealthCheck ¶
func DefaultHealthCheck(port int64, protocol annotations.AppProtocol) *HealthCheck
DefaultHealthCheck simply returns the default health check.
func DefaultNEGHealthCheck ¶
func DefaultNEGHealthCheck(protocol annotations.AppProtocol) *HealthCheck
DefaultHealthCheck simply returns the default health check.
func NewHealthCheck ¶
func NewHealthCheck(hc *computealpha.HealthCheck) (*HealthCheck, error)
NewHealthCheck creates a HealthCheck which abstracts nested structs away
func (*HealthCheck) Protocol ¶
func (hc *HealthCheck) Protocol() annotations.AppProtocol
Protocol returns the type cased to AppProtocol
func (*HealthCheck) ToAlphaComputeHealthCheck ¶
func (hc *HealthCheck) ToAlphaComputeHealthCheck() *computealpha.HealthCheck
ToAlphaComputeHealthCheck returns a valid computealpha.HealthCheck object
func (*HealthCheck) ToBetaComputeHealthCheck ¶ added in v1.2.2
func (hc *HealthCheck) ToBetaComputeHealthCheck() (*computebeta.HealthCheck, error)
ToBetaComputeHealthCheck returns a valid computebeta.HealthCheck object
func (*HealthCheck) ToComputeHealthCheck ¶
func (hc *HealthCheck) ToComputeHealthCheck() (*compute.HealthCheck, error)
ToComputeHealthCheck returns a valid compute.HealthCheck object
func (*HealthCheck) Version ¶ added in v1.2.2
func (hc *HealthCheck) Version() meta.Version
Version returns the appropriate API version to handle the health check Use Beta API for NEG as PORT_SPECIFICATION is required, and HTTP2
type HealthCheckProvider ¶
type HealthCheckProvider interface { CreateHTTPHealthCheck(hc *compute.HttpHealthCheck) error UpdateHTTPHealthCheck(hc *compute.HttpHealthCheck) error DeleteHTTPHealthCheck(name string) error GetHTTPHealthCheck(name string) (*compute.HttpHealthCheck, error) CreateAlphaHealthCheck(hc *computealpha.HealthCheck) error CreateBetaHealthCheck(hc *computebeta.HealthCheck) error CreateHealthCheck(hc *compute.HealthCheck) error UpdateAlphaHealthCheck(hc *computealpha.HealthCheck) error UpdateBetaHealthCheck(hc *computebeta.HealthCheck) error UpdateHealthCheck(hc *compute.HealthCheck) error DeleteHealthCheck(name string) error GetAlphaHealthCheck(name string) (*computealpha.HealthCheck, error) GetBetaHealthCheck(name string) (*computebeta.HealthCheck, error) GetHealthCheck(name string) (*compute.HealthCheck, error) }
HealthCheckProvider is an interface to manage a single GCE health check. TODO: (shance) convert this to use composite types
type HealthChecker ¶
type HealthChecker interface { New(sp utils.ServicePort) *HealthCheck Sync(hc *HealthCheck) (string, error) Delete(name string, scope meta.KeyType) error Get(name string, version meta.Version, scope meta.KeyType) (*HealthCheck, error) }
HealthChecker is an interface to manage cloud HTTPHealthChecks.
func NewHealthChecker ¶
func NewHealthChecker(cloud HealthCheckProvider, healthCheckPath string, defaultBackendHealthCheckPath string, defaultBackendSvc types.NamespacedName) HealthChecker
NewHealthChecker creates a new health checker. cloud: the cloud object implementing SingleHealthCheck. defaultHealthCheckPath: is the HTTP path to use for health checks.
type HealthChecks ¶
type HealthChecks struct {
// contains filtered or unexported fields
}
HealthChecks manages health checks.
func (*HealthChecks) Delete ¶
func (h *HealthChecks) Delete(name string, scope meta.KeyType) error
Delete deletes the health check by port.
func (*HealthChecks) Get ¶
func (h *HealthChecks) Get(name string, version meta.Version, scope meta.KeyType) (*HealthCheck, error)
Get returns the health check by port
func (*HealthChecks) New ¶
func (h *HealthChecks) New(sp utils.ServicePort) *HealthCheck
New returns a *HealthCheck with default settings and specified port/protocol
func (*HealthChecks) Sync ¶
func (h *HealthChecks) Sync(hc *HealthCheck) (string, error)
Sync retrieves a health check based on port, checks type and settings and updates/creates if necessary. Sync is only called by the backends.Add func - it's not a pool like other resources.