health

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Aug 9, 2020 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// EventTypeWarning is for Warning events
	EventTypeWarning = "Warning"
)

Variables

This section is empty.

Functions

func IsWorse

func IsWorse(current, latest StatusCode) bool

IsWorse returns whether or not the new health status code is a worse condition than the current

func MustRegisterCheckFunc

func MustRegisterCheckFunc(group, version, kind string, fn CheckFunc)

MustRegisterCheckFunc registers new resource check funcs or panics if already registered

func RegisterCheckFunc

func RegisterCheckFunc(group, version, kind string, fn CheckFunc) error

RegisterCheckFunc registers new resource check funcs or returns an error if already registered

func TrailingWarningEvent

func TrailingWarningEvent(events []corev1.Event) []corev1.Event

TrailingWarningEvent returns all "Warning" type events from the end of the list events should be sorted by "lastTimestamp"

func WarningEventsLessThanAge

func WarningEventsLessThanAge(events []corev1.Event, dur time.Duration, options ...WarningEventAgeOption) []corev1.Event

WarningEventsLessThanAge returns all "Warning" type events that have happened since the given time (1 second minimum resolution)

Types

type CheckFunc

type CheckFunc func(obj unstructured.Unstructured) (Status, error)

CheckFunc describes the function signature for all check functions

func GetCheckFunc

func GetCheckFunc(group, version, kind string) (CheckFunc, error)

GetCheckFunc returns the resource health check function registered for the given group, version and kind or an error if no check function exists

type ResourceHealthOption

type ResourceHealthOption func(options *ResourceHealthOptions)

ResourceHealthOption is part of the functional API for ResourceHealth

type ResourceHealthOptions

type ResourceHealthOptions struct {
	Override CheckFunc
}

ResourceHealthOptions is part of the functional API for ResourceHealth

type Status

type Status struct {
	Code    StatusCode `json:"status,omitempty"`
	Message string     `json:"message,omitempty"`
}

Status holds health assessment results

func NewHealthyHealthStatus

func NewHealthyHealthStatus() Status

NewHealthyHealthStatus returns a healthy Status struct

func ResourceHealth

func ResourceHealth(obj unstructured.Unstructured, options ...ResourceHealthOption) Status

ResourceHealth returns the health of a k8s resource

type StatusCode

type StatusCode string

StatusCode represents resource health status

const (
	// Unknown indicates that health assessment failed and actual health status is unknown
	Unknown StatusCode = "Unknown"
	// Progressing health status means that resource is not healthy but still have a chance to reach healthy state
	Progressing StatusCode = "Progressing"
	// Healthy indicates the resource is 100% healthy
	Healthy StatusCode = "Healthy"
	// Suspended indicates the resource is suspended or paused. The typical example is a
	// [suspended](https://kubernetes.io/docs/tasks/job/automated-tasks-with-cron-jobs/#suspend) CronJob.
	Suspended StatusCode = "Suspended"
	// Degraded status is used if resource status indicates failure or resource could not reach healthy state
	// within some timeout.
	Degraded StatusCode = "Degraded"
	// Unsupported indicates that the resource does have a health check available to run
	Unsupported StatusCode = "Unsupported"
	// Missing indicates that resource is missing from the cluster.
	Missing StatusCode = "Missing"
)

func GetCodeOrder

func GetCodeOrder() []StatusCode

GetCodeOrder returns a list of health codes in order of most healthy to least healthy

type WarningEventAgeOption

type WarningEventAgeOption func(options *WarningEventAgeOptions)

WarningEventAgeOption provides for a functional API for func WarningEventsLessThanAge

type WarningEventAgeOptions

type WarningEventAgeOptions struct {
	// contains filtered or unexported fields
}

WarningEventAgeOptions provide options for finding events

Directories

Path Synopsis
apis

Jump to

Keyboard shortcuts

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