healthchecks

package
v1.4.2 Latest Latest
Warning

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

Go to latest
Published: Jan 16, 2019 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
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) CreateBetaHealthCheck added in v1.2.2

func (f *FakeHealthCheckProvider) CreateBetaHealthCheck(hc *computebeta.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)

func (*FakeHealthCheckProvider) GetBetaHealthCheck added in v1.2.2

func (f *FakeHealthCheckProvider) GetBetaHealthCheck(name string) (*computebeta.HealthCheck, error)

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) UpdateBetaHealthCheck added in v1.2.2

func (f *FakeHealthCheckProvider) UpdateBetaHealthCheck(hc *computebeta.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

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.

type HealthChecker

type HealthChecker interface {
	New(sp utils.ServicePort) *HealthCheck
	Sync(hc *HealthCheck) (string, error)
	Delete(name string) error
	Get(name string, version meta.Version) (*HealthCheck, error)
}

HealthChecker is an interface to manage cloud HTTPHealthChecks.

func NewHealthChecker

func NewHealthChecker(cloud HealthCheckProvider, healthCheckPath string, defaultBackendHealthCheckPath string, namer *utils.Namer, 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) error

Delete deletes the health check by port.

func (*HealthChecks) Get

func (h *HealthChecks) Get(name string, version meta.Version) (*HealthCheck, error)

Get returns the health check by port

func (*HealthChecks) New

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.

Jump to

Keyboard shortcuts

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