readiness

package
v0.0.16 Latest Latest
Warning

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

Go to latest
Published: Jul 9, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Check

type Check struct {
	Name string
	// contains filtered or unexported fields
}

Check represents a parsed readiness check CEL expression.

func ParseCheck

func ParseCheck(env *Env, expr string) (*Check, error)

ParseCheck parses the given CEL expression in the context of an environment, and returns a reusable execution handle.

func (*Check) Eval

func (r *Check) Eval(ctx context.Context, resource *unstructured.Unstructured) (*Status, bool)

Eval executes the compiled check against a given resource.

type Checks

type Checks []*Check

func (Checks) Eval

func (r Checks) Eval(ctx context.Context, resource *unstructured.Unstructured) (*Status, bool)

Eval evaluates and prioritizes the set of readiness checks.

- Nil is returned when less than all of the checks are ready - If some precise and some inprecise times are given, the precise times are favored - Within precise or non-precise times, the max of that group is always used

func (Checks) EvalOptionally

func (r Checks) EvalOptionally(ctx context.Context, resource *unstructured.Unstructured) (*Status, bool)

EvalOptionally is identical to Eval, except it returns the current time in the status if no checks are set.

type Env

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

Env encapsulates a CEL environment for use in readiness checks.

func NewEnv

func NewEnv() (*Env, error)

type Status

type Status struct {
	ReadyTime   metav1.Time
	PreciseTime bool // true when time came from a condition, not the controller's metav1.Now
}

Jump to

Keyboard shortcuts

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