probing

package
v1.11.0 Latest Latest
Warning

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

Go to latest
Published: Apr 18, 2024 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Overview

Package probing contains declarative status probing implementations for various different Kubernetes objects.

Index

Constants

This section is empty.

Variables

View Source
var ErrCELInvalidEvaluationType = errors.New("cel expression must evaluate to a bool")

ErrCELInvalidEvaluationType is raised when a CEL expression does not evaluate to a boolean.

Functions

This section is empty.

Types

type And

type And []Prober

And combines multiple Prober, only passing if all given Probers succeed. Messages of failing Probers will be joined with ", ", returning a single string.

func (And) Probe

func (p And) Probe(obj *unstructured.Unstructured) (success bool, message string)

Probe executes the probe.

type CELProbe

type CELProbe struct {
	Program cel.Program
	Message string
}

CELProbe uses the common expression language for probing.

func NewCELProbe

func NewCELProbe(rule, message string) (
	*CELProbe, error,
)

NewCELProbe creates a new CEL (Common Expression Language) Probe. A CEL probe runs a CEL expression against the target object that needs to evaluate to a bool.

func (*CELProbe) Probe

func (p *CELProbe) Probe(obj *unstructured.Unstructured) (success bool, message string)

Probe executes the probe.

type ConditionProbe

type ConditionProbe struct {
	Type, Status string
}

ConditionProbe checks if the object's condition is set and in a certain status.

func (*ConditionProbe) Probe

func (cp *ConditionProbe) Probe(obj *unstructured.Unstructured) (success bool, message string)

Probe executes the probe.

type FieldsEqualProbe

type FieldsEqualProbe struct {
	FieldA, FieldB string
}

FieldsEqualProbe checks if the values of the fields under the given json paths are equal.

func (*FieldsEqualProbe) Probe

func (fe *FieldsEqualProbe) Probe(obj *unstructured.Unstructured) (success bool, message string)

Probe executes the probe.

type GroupKindSelector

type GroupKindSelector struct {
	Prober
	schema.GroupKind
}

GroupKindSelector wraps a Probe object and only executes the probe when the probed object is of the right Group and Kind. Objects not matching the slector are considered to pass the probe.

func (*GroupKindSelector) Probe

func (kp *GroupKindSelector) Probe(obj *unstructured.Unstructured) (success bool, message string)

Probe executes the probe.

type LabelSelector

type LabelSelector struct {
	Prober
	labels.Selector
}

LabelSelector wraps a Probe object and only executes the probe when the probed object is matching the given label selector. Objects not matching the slector are considered to pass the probe.

func (*LabelSelector) Probe

func (ss *LabelSelector) Probe(obj *unstructured.Unstructured) (success bool, message string)

Probe executes the probe.

type ObservedGenerationProbe

type ObservedGenerationProbe struct {
	Prober
}

ObservedGenerationProbe wraps the given Prober and ensures that .status.observedGeneration is equal to .metadata.generation, before running the given probe. If the probed object does not contain the .status.observedGeneration field, the given prober is executed directly.

func (*ObservedGenerationProbe) Probe

func (cg *ObservedGenerationProbe) Probe(obj *unstructured.Unstructured) (success bool, message string)

Probe executes the probe.

type Prober

type Prober interface {
	Probe(obj *unstructured.Unstructured) (success bool, message string)
}

Prober check Kubernetes objects for certain conditions and report success or failure with a failure message.

Jump to

Keyboard shortcuts

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