condmapper

package
v1.75.0 Latest Latest
Warning

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

Go to latest
Published: Mar 17, 2026 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Mapper

type Mapper struct {
	Rules []Rule
}

Mapper applies rules to compute external conditions.

func (Mapper) Map

func (m Mapper) Map(state State) []metav1.Condition

Map evaluates all rules and returns computed external conditions.

type Predicate

type Predicate func(State) match

Predicate evaluates state and returns match with source.

func AllTrue

func AllTrue(conds ...string) Predicate

AllTrue checks if all conditions are True. Returns first condition as source.

func And

func And(preds ...Predicate) Predicate

And combines predicates with logical AND. Returns last source.

func AnyFalse

func AnyFalse(conds ...string) Predicate

AnyFalse checks if any condition is False. Returns failing condition as source.

func ExtPresent

func ExtPresent(cond string) Predicate

ExtPresent checks if an external condition exists (regardless of status).

func ExtTrue

func ExtTrue(cond string) Predicate

ExtTrue checks if an external condition is True.

func IsTrue

func IsTrue(cond string) Predicate

IsTrue checks if a single condition is True.

func Not

func Not(p Predicate) Predicate

Not negates a predicate. Clears source on negation.

func Or

func Or(preds ...Predicate) Predicate

Or combines predicates with logical OR. Returns first matching source.

func VersionChanged

func VersionChanged() Predicate

VersionChanged checks if version changed flag is set.

type Rule

type Rule struct {
	Type    string    // external condition type name
	TrueIf  Predicate // set True when matched; source used for Reason/Message
	FalseIf Predicate // set False when matched; source used for Reason/Message
	OnlyIf  Predicate // precondition; skip rule if not matched
	Sticky  bool      // once True, stays True forever
}

Rule defines how to compute an external condition from internal state.

type State

type State struct {
	VersionChanged bool                        // true if package version changed
	Internal       map[string]metav1.Condition // source conditions
	External       map[string]metav1.Condition // previous external state
}

State holds internal and external conditions for mapping.

Jump to

Keyboard shortcuts

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