conditions

package
v0.17.0 Latest Latest
Warning

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

Go to latest
Published: Aug 12, 2025 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const EventReasonConditionChanged = "ConditionChanged"

Variables

This section is empty.

Functions

func AllConditionsHaveStatus

func AllConditionsHaveStatus(status metav1.ConditionStatus, conditions ...metav1.Condition) bool

AllConditionsHaveStatus returns true if all conditions have the specified status.

func ConditionUpdater

func ConditionUpdater(conditions []metav1.Condition, removeUntouched bool) *conditionUpdater

ConditionUpdater creates a builder-like helper struct for updating a list of Conditions. The 'constructor' argument is a function that returns a new (empty) instance of the condition implementation type. The 'conditions' argument contains the old condition list. If removeUntouched is true, the condition list returned with Conditions() will have all conditions removed that have not been updated. If false, all conditions will be kept. Note that calling this function stores the current time as timestamp that is used as timestamp if a condition's status changed. To overwrite this timestamp, modify the 'Now' field of the returned struct manually.

The given condition list is not modified.

Usage example: status.conditions = ConditionUpdater(status.conditions, true).UpdateCondition(...).UpdateCondition(...).Conditions()

func FromBool added in v0.13.0

func FromBool(status bool) metav1.ConditionStatus

FromBool returns the metav1.ConditionStatus that matches the given bool value. true = ConditionTrue false = ConditionFalse

func FromBoolPointer added in v0.13.0

func FromBoolPointer(status *bool) metav1.ConditionStatus

FromBoolPointer returns the metav1.ConditionStatus that matches the given bool pointer. nil = ConditionUnknown true = ConditionTrue false = ConditionFalse

func GetCondition

func GetCondition(conditions []metav1.Condition, conditionType string) *metav1.Condition

GetCondition is an alias for apimeta.FindStatusCondition. It returns a pointer to the condition of the specified type from the given conditions slice, or nil if not found.

func ToBoolPointer added in v0.13.0

func ToBoolPointer(status metav1.ConditionStatus) *bool

ToBoolPointer is the inverse of FromBoolPointer. It returns a pointer to a bool that matches the given ConditionStatus. If the status is ConditionTrue, it returns a pointer to true. If the status is ConditionFalse, it returns a pointer to false. If the status is ConditionUnknown or any unknown value, it returns nil.

Types

type EventVerbosity added in v0.13.0

type EventVerbosity string
const (
	// EventPerChange causes one event to be recorded for each condition that has changed.
	// This is the most verbose setting. The old and new status of each changed condition will be visible in the event message.
	EventPerChange EventVerbosity = "perChange"
	// EventPerNewStatus causes one event to be recorded for each new status that any condition has reached.
	// This means that at max four events will be recorded:
	// - the following conditions changed to True (including newly added conditions)
	// - the following conditions changed to False (including newly added conditions)
	// - the following conditions changed to Unknown (including newly added conditions)
	// - the following conditions were removed
	// The old status of the conditions will not be part of the event message.
	EventPerNewStatus EventVerbosity = "perNewStatus"
	// EventIfChanged causes a single event to be recorded if any condition's status has changed.
	// All changed conditions will be listed, but not their old or new status.
	EventIfChanged EventVerbosity = "ifChanged"
)

Jump to

Keyboard shortcuts

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