external

package
v2.4.0 Latest Latest
Warning

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

Go to latest
Published: Feb 4, 2021 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Overview

Package external is a kuberhealthy checker that acts as an operator to run external images as checks.

Index

Constants

View Source
const CRDGroup = "comcast.github.io"

CRDGroup constant value for grouping Kuberhealthy's custom resource definitions on a server.

View Source
const CRDVersion = "v1"

CRDVersion constant value for versoning Kuberhealthy's custom resource definitions.

View Source
const DefaultKuberhealthyReportingURL = "http://kuberhealthy.kuberhealthy.svc.cluster.local/externalCheckStatus"

DefaultKuberhealthyReportingURL is the default location that external checks are expected to report into.

View Source
const KHCheckNameAnnotationKey = "comcast.github.io/check-name"

KHCheckNameAnnotationKey is the annotation which holds the check's name for later validation when the pod calls in

View Source
const KHDeadline = "KH_CHECK_RUN_DEADLINE"

KHDeadline is the environment variable name for when checks must finish their runs by in unixtime

View Source
const KHPodNamespace = "KH_POD_NAMESPACE"

KHPodNamespace is the namespace variable used to tell external checks their namespace to perform checks in.

View Source
const KHReportingURL = "KH_REPORTING_URL"

KHReportingURL is the environment variable used to tell external checks where to send their status updates

View Source
const KHRunUUID = "KH_RUN_UUID"

KHRunUUID is the environment variable used to tell external checks their check's UUID so that they can be de-duplicated on the server side.

Variables

View Source
var DefaultName = "external-check"

DefaultName is used when no check name is supplied

View Source
var ErrPodDeletedBeforeRunning = errors.New("the khcheck check pod is deleted, waiting for start failed")

ErrPodDeletedBeforeRunning is a constant for the error when a pod is deleted before the check pod running

View Source
var ErrPodRemovedExpectedly = errors.New("pod deleted expectedly")

ErrPodRemovedExpectedly is a constant for the error when a pod is deleted expectedly during a check run

View Source
var ErrPodRemovedUnexpectedly = errors.New("pod deleted unexpectedly")

ErrPodRemovedUnexpectedly is a constant for the error when a pod is deleted unexpectedly during a check run

Functions

This section is empty.

Types

type Checker

type Checker struct {
	CheckName                string // the name of this checker
	Namespace                string
	RunInterval              time.Duration // how often this check runs a loop
	RunTimeout               time.Duration // time check must run completely within
	KubeClient               *kubernetes.Clientset
	KHJobClient              *khjobcrd.KHJobV1Client
	KHCheckClient            *khcheckcrd.KuberhealthyCheckClient
	KHStateClient            *khstatecrd.KuberhealthyStateClient
	PodSpec                  apiv1.PodSpec // the current pod spec we are using after enforcement of settings
	OriginalPodSpec          apiv1.PodSpec // the user-provided spec of the pod
	RunID                    string        // the uuid of the current run
	KuberhealthyReportingURL string        // the URL that the check should want to report results back to
	ExtraAnnotations         map[string]string
	ExtraLabels              map[string]string

	Debug bool // indicates we should run in debug mode - run once and stop

	KHWorkload health.KHWorkload
	// contains filtered or unexported fields
}

Checker implements a KuberhealthyCheck for external check execution and lifecycle management.

func New

func New(client *kubernetes.Clientset, checkConfig *khcheckcrd.KuberhealthyCheck, khCheckClient *khcheckcrd.KuberhealthyCheckClient, khStateClient *khstatecrd.KuberhealthyStateClient, reportingURL string) *Checker

New creates a new external checker

func NewCheck added in v2.3.0

func NewCheck(client *kubernetes.Clientset, checkConfig *khcheckcrd.KuberhealthyCheck, khCheckClient *khcheckcrd.KuberhealthyCheckClient, khStateClient *khstatecrd.KuberhealthyStateClient, reportingURL string) *Checker

func NewJob added in v2.3.0

func NewJob(client *kubernetes.Clientset, jobConfig *khjobcrd.KuberhealthyJob, khJobClient *khjobcrd.KHJobV1Client, khStateClient *khstatecrd.KuberhealthyStateClient, reportingURL string) *Checker

func (*Checker) CheckNamespace

func (ext *Checker) CheckNamespace() string

CheckNamespace returns the namespace of this checker

func (*Checker) CurrentStatus

func (ext *Checker) CurrentStatus() (bool, []string)

CurrentStatus returns the status of the check as of right now. For the external checker, this means checking the khstatus resources on the cluster.

func (*Checker) Interval

func (ext *Checker) Interval() time.Duration

Interval returns the interval at which this check runs

func (*Checker) Name

func (ext *Checker) Name() string

Name returns the name of this check. This name is used when creating a check status CRD as well as for the status output

func (*Checker) Run

func (ext *Checker) Run(ctx context.Context, client *kubernetes.Clientset) error

Run executes the checker. This is ran on each "tick" of the RunInterval and is executed by the Kuberhealthy checker

func (*Checker) RunOnce

func (ext *Checker) RunOnce(ctx context.Context) error

RunOnce runs one check loop. This creates a checker pod and ensures it starts, then ensures it changes to Running properly

func (*Checker) Shutdown

func (ext *Checker) Shutdown() error

Shutdown signals the checker to begin a shutdown and cleanup

func (*Checker) Timeout

func (ext *Checker) Timeout() time.Duration

Timeout returns the maximum run time for this check before it times out

Directories

Path Synopsis
Package checkclient implements a client for reporting the state of an externally spawned checker pod to Kuberhealthy.
Package checkclient implements a client for reporting the state of an externally spawned checker pod to Kuberhealthy.
Package status holds a struct that can be used to report external check status to the Kuberhealthy status reporting endpoint.
Package status holds a struct that can be used to report external check status to the Kuberhealthy status reporting endpoint.

Jump to

Keyboard shortcuts

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