healthcheck

package
v18.8.2+incompatible Latest Latest
Warning

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

Go to latest
Published: Aug 22, 2018 License: Apache-2.0 Imports: 12 Imported by: 29

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

	// 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 and
	// control 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 ShouldCheckControllerVersion option is false.
	LinkerdVersionChecks

	KubernetesAPICategory     = "kubernetes-api"
	LinkerdPreInstallCategory = "linkerd-ns"
	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 {
	Namespace                    string
	KubeConfig                   string
	APIAddr                      string
	VersionOverride              string
	ShouldRetry                  bool
	ShouldCheckKubeVersion       bool
	ShouldCheckControllerVersion 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