condmap

package
v1.77.6 Latest Latest
Warning

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

Go to latest
Published: Nov 4, 2026 License: Apache-2.0 Imports: 2 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const ReasonDeleting = "Deleting"

ReasonDeleting is the reason every external condition carries while its package is being removed. The runtime keeps its own copy for the internal conditions (packages/status.ConditionReasonDeleting); the two are the same word by intent, not by reference — internal reasons are never exported as-is.

Variables

This section is empty.

Functions

This section is empty.

Types

type Map

type Map struct {
	Type string
	Fn   func(state State) metav1.Condition
	Gate string
}

Map computes at most one external condition from a mapping state. Type names the condition Fn produces, so a mapper knows its own vocabulary without evaluating anything; Fn returns an empty condition to leave it unchanged.

Gate, when set, names the condition this one is reported behind: while the gate is not True once the run is applied, the condition is removed from the resource whatever Fn returns.

type Mapper

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

Mapper applies condition maps to compute external conditions.

func NewMapper added in v1.77.2

func NewMapper(maps ...Map) Mapper

NewMapper builds a mapper from an ordered list of condition maps. Order matters when callers care about deterministic condition update ordering.

func (Mapper) Map

func (m Mapper) Map(state State) Result

Map evaluates all condition maps and returns the non-empty external conditions to set, and the gated conditions to remove.

While the state reports a deletion it returns every condition the mapper can produce as False/ReasonDeleting instead, gated or not. The maps read a state that still describes the last reconcile, and one that emits nothing would leave its condition — the sticky Installed above all — claiming the package is still there.

type Result added in v1.77.2

type Result struct {
	// Set holds the conditions to set, in evaluation order.
	Set []metav1.Condition
	// Remove holds the gated condition types whose gate is not True.
	Remove []string
}

Result is what one mapping run changes on the resource.

type State

type State struct {
	Deleting bool                        // true when the package is being removed
	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) IsDeleting added in v1.77.2

func (s *State) IsDeleting() bool

IsDeleting reports whether this mapping run observes a package being removed.

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