Documentation ¶
Overview ¶
Package external is a kuberhealthy checker that acts as an operator to run external images as checks.
Index ¶
- Constants
- Variables
- type Checker
- func (ext *Checker) CheckNamespace() string
- func (ext *Checker) CurrentStatus() (bool, []string)
- func (ext *Checker) Interval() time.Duration
- func (ext *Checker) Name() string
- func (ext *Checker) Run(ctx context.Context, client *kubernetes.Clientset) error
- func (ext *Checker) RunOnce(ctx context.Context) error
- func (ext *Checker) Shutdown() error
- func (ext *Checker) Timeout() time.Duration
Constants ¶
const CRDGroup = "comcast.github.io"
CRDGroup constant value for grouping Kuberhealthy's custom resource definitions on a server.
const CRDVersion = "v1"
CRDVersion constant value for versoning Kuberhealthy's custom resource definitions.
const DefaultKuberhealthyReportingURL = "http://kuberhealthy.kuberhealthy.svc.cluster.local/externalCheckStatus"
DefaultKuberhealthyReportingURL is the default location that external checks are expected to report into.
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
const KHDeadline = "KH_CHECK_RUN_DEADLINE"
KHDeadline is the environment variable name for when checks must finish their runs by in unixtime
const KHPodNamespace = "KH_POD_NAMESPACE"
KHPodNamespace is the namespace variable used to tell external checks their namespace to perform checks in.
const KHReportingURL = "KH_REPORTING_URL"
KHReportingURL is the environment variable used to tell external checks where to send their status updates
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 ¶
var DefaultName = "external-check"
DefaultName is used when no check name is supplied
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
var ErrPodRemovedExpectedly = errors.New("pod deleted expectedly")
ErrPodRemovedExpectedly is a constant for the error when a pod is deleted expectedly during a check run
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 ¶
CheckNamespace returns the namespace of this checker
func (*Checker) CurrentStatus ¶
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) Name ¶
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 ¶
Run executes the checker. This is ran on each "tick" of the RunInterval and is executed by the Kuberhealthy checker
func (*Checker) RunOnce ¶
RunOnce runs one check loop. This creates a checker pod and ensures it starts, then ensures it changes to Running properly
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. |