Documentation
¶
Index ¶
- Constants
- type Map
- type Mapper
- type Result
- type State
- func (s *State) AllIntEqual(status metav1.ConditionStatus, conditions ...string) bool
- func (s *State) ConditionByInt(cond string, condStatus metav1.ConditionStatus, internalCond string) metav1.Condition
- func (s *State) ExtEqual(cond string, status metav1.ConditionStatus) bool
- func (s *State) GetExtReason(cond string) (string, string)
- func (s *State) GetIntReason(cond string) (string, string)
- func (s *State) GetIntStatus(cond string) (metav1.ConditionStatus, bool)
- func (s *State) HasExt(cond string) bool
- func (s *State) HasInt(cond string) bool
- func (s *State) IntEqual(cond string, status metav1.ConditionStatus) bool
- func (s *State) IsDeleting() bool
- func (s *State) IsUpdating() bool
Constants ¶
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 ¶
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
NewMapper builds a mapper from an ordered list of condition maps. Order matters when callers care about deterministic condition update ordering.
func (Mapper) Map ¶
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 ¶
GetExtReason returns the Reason and Message of an external condition. Returns ("", "") if the condition is absent.
func (*State) GetIntReason ¶
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) 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
IsDeleting reports whether this mapping run observes a package being removed.
func (*State) IsUpdating ¶
IsUpdating reports whether this mapping run observes a version change.