Documentation ¶
Index ¶
- Constants
- type FakeHealthCheckProvider
- func (f *FakeHealthCheckProvider) CreateAlphaHealthCheck(hc *computealpha.HealthCheck) error
- func (f *FakeHealthCheckProvider) CreateHealthCheck(hc *compute.HealthCheck) error
- func (f *FakeHealthCheckProvider) CreateHttpHealthCheck(hc *compute.HttpHealthCheck) error
- func (f *FakeHealthCheckProvider) DeleteHealthCheck(name string) error
- func (f *FakeHealthCheckProvider) DeleteHttpHealthCheck(name string) error
- func (f *FakeHealthCheckProvider) GetAlphaHealthCheck(name string) (*computealpha.HealthCheck, error)
- func (f *FakeHealthCheckProvider) GetHealthCheck(name string) (*compute.HealthCheck, error)
- func (f *FakeHealthCheckProvider) GetHttpHealthCheck(name string) (*compute.HttpHealthCheck, error)
- func (f *FakeHealthCheckProvider) UpdateAlphaHealthCheck(hc *computealpha.HealthCheck) error
- func (f *FakeHealthCheckProvider) UpdateHealthCheck(hc *compute.HealthCheck) error
- func (f *FakeHealthCheckProvider) UpdateHttpHealthCheck(hc *compute.HttpHealthCheck) error
- type HealthCheck
- type HealthCheckProvider
- type HealthChecker
- type HealthChecks
- func (h *HealthChecks) Delete(port int64) error
- func (h *HealthChecks) DeleteLegacy(port int64) error
- func (h *HealthChecks) Get(port int64, alpha bool) (*HealthCheck, error)
- func (h *HealthChecks) GetLegacy(port int64) (*compute.HttpHealthCheck, error)
- func (h *HealthChecks) New(port int64, protocol annotations.AppProtocol, enableNEG bool) *HealthCheck
- func (h *HealthChecks) Sync(hc *HealthCheck) (string, error)
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 FakeHealthCheckProvider ¶
type FakeHealthCheckProvider struct {
// contains filtered or unexported fields
}
FakeHealthCheckProvider fakes out health checks.
func NewFakeHealthCheckProvider ¶
func NewFakeHealthCheckProvider() *FakeHealthCheckProvider
NewFakeHealthCheckProvider returns a new FakeHealthChecks.
func (*FakeHealthCheckProvider) CreateAlphaHealthCheck ¶
func (f *FakeHealthCheckProvider) CreateAlphaHealthCheck(hc *computealpha.HealthCheck) error
CreateHealthCheck fakes out http health check creation.
func (*FakeHealthCheckProvider) CreateHealthCheck ¶
func (f *FakeHealthCheckProvider) CreateHealthCheck(hc *compute.HealthCheck) error
CreateHealthCheck fakes out http health check creation.
func (*FakeHealthCheckProvider) CreateHttpHealthCheck ¶
func (f *FakeHealthCheckProvider) CreateHttpHealthCheck(hc *compute.HttpHealthCheck) error
CreateHttpHealthCheck fakes out http health check creation.
func (*FakeHealthCheckProvider) DeleteHealthCheck ¶
func (f *FakeHealthCheckProvider) DeleteHealthCheck(name string) error
DeleteHealthCheck fakes out deleting a http health check.
func (*FakeHealthCheckProvider) DeleteHttpHealthCheck ¶
func (f *FakeHealthCheckProvider) DeleteHttpHealthCheck(name string) error
DeleteHttpHealthCheck fakes out deleting a http health check.
func (*FakeHealthCheckProvider) GetAlphaHealthCheck ¶
func (f *FakeHealthCheckProvider) GetAlphaHealthCheck(name string) (*computealpha.HealthCheck, error)
GetHealthCheck fakes out getting a http health check from the cloud.
func (*FakeHealthCheckProvider) GetHealthCheck ¶
func (f *FakeHealthCheckProvider) GetHealthCheck(name string) (*compute.HealthCheck, error)
GetHealthCheck fakes out getting a http health check from the cloud.
func (*FakeHealthCheckProvider) GetHttpHealthCheck ¶
func (f *FakeHealthCheckProvider) GetHttpHealthCheck(name string) (*compute.HttpHealthCheck, error)
GetHttpHealthCheck fakes out getting a http health check from the cloud.
func (*FakeHealthCheckProvider) UpdateAlphaHealthCheck ¶
func (f *FakeHealthCheckProvider) UpdateAlphaHealthCheck(hc *computealpha.HealthCheck) error
func (*FakeHealthCheckProvider) UpdateHealthCheck ¶
func (f *FakeHealthCheckProvider) UpdateHealthCheck(hc *compute.HealthCheck) error
UpdateHealthCheck sends the given health check as an update.
func (*FakeHealthCheckProvider) UpdateHttpHealthCheck ¶
func (f *FakeHealthCheckProvider) UpdateHttpHealthCheck(hc *compute.HttpHealthCheck) error
UpdateHttpHealthCheck sends the given health check as an update.
type HealthCheck ¶
type HealthCheck struct { computealpha.HTTPHealthCheck computealpha.HealthCheck ForNEG bool }
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
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
ToComputeHealthCheck returns a valid compute.HealthCheck object
func (*HealthCheck) ToComputeHealthCheck ¶
func (hc *HealthCheck) ToComputeHealthCheck() (*compute.HealthCheck, error)
ToComputeHealthCheck returns a valid compute.HealthCheck object
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 CreateHealthCheck(hc *compute.HealthCheck) error UpdateAlphaHealthCheck(hc *computealpha.HealthCheck) error UpdateHealthCheck(hc *compute.HealthCheck) error DeleteHealthCheck(name string) error GetAlphaHealthCheck(name string) (*computealpha.HealthCheck, error) GetHealthCheck(name string) (*compute.HealthCheck, error) }
HealthCheckProvider is an interface to manage a single GCE health check.
type HealthChecker ¶
type HealthChecker interface { New(port int64, protocol annotations.AppProtocol, enableNEG bool) *HealthCheck Sync(hc *HealthCheck) (string, error) Delete(port int64) error Get(port int64, alpha bool) (*HealthCheck, error) GetLegacy(port int64) (*compute.HttpHealthCheck, error) DeleteLegacy(port int64) error }
HealthChecker is an interface to manage cloud HTTPHealthChecks.
func NewHealthChecker ¶
func NewHealthChecker(cloud HealthCheckProvider, defaultHealthCheckPath string, namer *utils.Namer) 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(port int64) error
Delete deletes the health check by port.
func (*HealthChecks) DeleteLegacy ¶
func (h *HealthChecks) DeleteLegacy(port int64) error
DeleteLegacy deletes legacy HTTP health checks
func (*HealthChecks) Get ¶
func (h *HealthChecks) Get(port int64, alpha bool) (*HealthCheck, error)
Get returns the health check by port
func (*HealthChecks) GetLegacy ¶
func (h *HealthChecks) GetLegacy(port int64) (*compute.HttpHealthCheck, error)
GetLegacy deletes legacy HTTP health checks
func (*HealthChecks) New ¶
func (h *HealthChecks) New(port int64, protocol annotations.AppProtocol, enableNEG bool) *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.