healthchecks

package
v0.0.0-...-c8e4b7a Latest Latest
Warning

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

Go to latest
Published: Aug 2, 2020 License: Apache-2.0 Imports: 6 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
	DefaultHealthCheckInterval = 60 * 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 backend "unhealthy"
	DefaultUnhealthyThreshold = 10
	// DefaultTimeout defines the timeout of each probe
	DefaultTimeout = 60 * time.Second
)

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) 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) 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) 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 {
	compute.HTTPHealthCheck
	compute.HealthCheck
}

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 utils.AppProtocol) *HealthCheck

DefaultHealthCheck simply returns the default health check.

func NewHealthCheck

func NewHealthCheck(hc *compute.HealthCheck) *HealthCheck

NewHealthCheck creates a HealthCheck which abstracts nested structs away

func (*HealthCheck) Protocol

func (hc *HealthCheck) Protocol() utils.AppProtocol

Protocol returns the type cased to AppProtocol

func (*HealthCheck) ToComputeHealthCheck

func (hc *HealthCheck) ToComputeHealthCheck() *compute.HealthCheck

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)

	CreateHealthCheck(hc *compute.HealthCheck) error
	UpdateHealthCheck(hc *compute.HealthCheck) error
	DeleteHealthCheck(name string) 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 utils.AppProtocol) *HealthCheck
	Sync(hc *HealthCheck) (string, error)
	Delete(port int64) error
	Get(port int64) (*HealthCheck, 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) (*HealthCheck, error)

Get returns the health check by port

func (*HealthChecks) New

func (h *HealthChecks) New(port int64, protocol utils.AppProtocol) *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.

Jump to

Keyboard shortcuts

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