condmap

package
v1.76.4 Latest Latest
Warning

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

Go to latest
Published: Jul 14, 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 Map

type Map func(state State) metav1.Condition

Map computes at most one external condition from a mapping state. Return an empty condition to leave that external condition unchanged.

type Mapper

type Mapper struct {
	// Maps is the ordered list of condition maps. Order matters when callers
	// care about deterministic condition update ordering.
	Maps []Map
}

Mapper applies condition maps to compute external conditions.

func (Mapper) Map

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

Map evaluates all condition maps and returns non-empty external conditions.

type State

type State struct {
	Updating bool                        // true when a version change is in progress
	Internal map[string]metav1.Condition // task-set conditions, keyed by condition type
	External map[string]metav1.Condition // previously computed user-facing conditions, read-only during mapping
}

State is the snapshot fed into a single mapping run. Internal holds conditions set by operator tasks (inputs to mapping). External holds user-facing conditions from the previous run; rules read it to implement sticky and guard behavior (e.g. Installed stays True once set).

func (*State) AllIntEqual

func (s *State) AllIntEqual(status metav1.ConditionStatus, conditions ...string) bool

AllIntEqual reports whether every listed internal condition has the given status. It returns false if any condition is absent.

func (*State) ConditionByInt

func (s *State) ConditionByInt(cond string, condStatus metav1.ConditionStatus, internalCond string) metav1.Condition

ConditionByInt builds an external condition that passes through reason and message from an internal condition. The result has empty reason if the internal condition has none — callers that need fallback handling should use their own helper.

func (*State) ExtEqual

func (s *State) ExtEqual(cond string, status metav1.ConditionStatus) bool

ExtEqual reports whether the external condition has the given status. Returns false if the condition is absent.

func (*State) GetExtReason

func (s *State) GetExtReason(cond string) (string, string)

GetExtReason returns the Reason and Message of an external condition. Returns ("", "") if the condition is absent.

func (*State) GetIntReason

func (s *State) GetIntReason(cond string) (string, string)

GetIntReason returns the Reason and Message of an internal condition. Returns ("", "") if the condition is absent.

func (*State) GetIntStatus

func (s *State) GetIntStatus(cond string) (metav1.ConditionStatus, bool)

GetIntStatus returns the status of an internal condition. Returns ("", false) if the condition is absent.

func (*State) HasExt

func (s *State) HasExt(cond string) bool

func (*State) HasInt

func (s *State) HasInt(cond string) bool

func (*State) IntEqual

func (s *State) IntEqual(cond string, status metav1.ConditionStatus) bool

IntEqual reports whether the internal condition has the given status. Returns false if the condition is absent.

func (*State) IsUpdating

func (s *State) IsUpdating() bool

IsUpdating reports whether this mapping run observes a version change.

Jump to

Keyboard shortcuts

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