healthcheck

package
v18.9.1+incompatible Latest Latest
Warning

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

Go to latest
Published: Sep 12, 2018 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// KubernetesAPIChecks adds a series of checks to validate that the caller is
	// configured to interact with a working Kubernetes cluster and that the
	// cluster meets the minimum version requirements, unless the
	// ShouldCheckKubeVersion option is false.
	KubernetesAPIChecks Checks = iota

	// LinkerdPreInstallChecks adds a check to validate that the control plane
	// namespace does not already exist. This check only runs as part of the set
	// of pre-install checks.
	// This check is dependent on the output of KubernetesAPIChecks, so those
	// checks must be added first.
	LinkerdPreInstallChecks

	// LinkerdDataPlaneChecks adds a data plane check to validate that the proxy
	// containers are in the ready state.
	// This check is dependent on the output of KubernetesAPIChecks, so those
	// checks must be added first.
	LinkerdDataPlaneChecks

	// LinkerdAPIChecks adds a series of checks to validate that the control plane
	// namespace exists and that it's successfully serving the public API.
	// These checks are dependent on the output of KubernetesAPIChecks, so those
	// checks must be added first.
	LinkerdAPIChecks

	// LinkerdVersionChecks adds a series of checks to validate that the CLI,
	// control plane, and data plane are running the latest available version.
	// These checks are dependent on the output of AddLinkerdAPIChecks, so those
	// checks must be added first, unless the the ShouldCheckControlPlaneVersion
	// and ShouldCheckDataPlaneVersion options are false.
	LinkerdVersionChecks

	KubernetesAPICategory     = "kubernetes-api"
	LinkerdPreInstallCategory = "linkerd-ns"
	LinkerdDataPlaneCategory  = "linkerd-data-plane"
	LinkerdAPICategory        = "linkerd-api"
	LinkerdVersionCategory    = "linkerd-version"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type CheckResult

type CheckResult struct {
	Category    string
	Description string
	Retry       bool
	Err         error
}

type Checks

type Checks int

type HealthCheckOptions

type HealthCheckOptions struct {
	ControlPlaneNamespace          string
	DataPlaneNamespace             string
	KubeConfig                     string
	APIAddr                        string
	VersionOverride                string
	ShouldRetry                    bool
	ShouldCheckKubeVersion         bool
	ShouldCheckControlPlaneVersion bool
	ShouldCheckDataPlaneVersion    bool
}

type HealthChecker

type HealthChecker struct {
	*HealthCheckOptions
	// contains filtered or unexported fields
}

func NewHealthChecker

func NewHealthChecker(checks []Checks, options *HealthCheckOptions) *HealthChecker

func (*HealthChecker) Add

func (hc *HealthChecker) Add(category, description string, check func() error)

Add adds an arbitrary checker. This should only be used for testing. For production code, pass in the desired set of checks when calling NewHeathChecker.

func (*HealthChecker) PublicAPIClient

func (hc *HealthChecker) PublicAPIClient() pb.ApiClient

PublicAPIClient returns a fully configured public API client. This client is only configured if the KubernetesAPIChecks and LinkerdAPIChecks are configured and run first.

func (*HealthChecker) RunChecks

func (hc *HealthChecker) RunChecks(observer checkObserver) bool

RunChecks runs all configured checkers, and passes the results of each check to the observer. If a check fails and is marked as fatal, then all remaining checks are skipped. If at least one check fails, RunChecks returns false; if all checks passed, RunChecks returns true.

Jump to

Keyboard shortcuts

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