conditions

package
v0.0.0-...-d0ef8b3 Latest Latest
Warning

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

Go to latest
Published: Nov 28, 2025 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package conditions provides utilities for managing status conditions on Kubernetes API objects.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Del

func Del(target Setter, conditionType string) (changed bool)

Del removes a condition of the specified type from the target object. It returns true if the condition was removed, false otherwise.

func FromError

func FromError(err error) metav1.Condition

FromError creates a v1alpha1.ConfiguredCondition from the given error. If the error is nil, it returns a condition indicating success. If the error is a gRPC status error, it extracts the code and message to populate the condition's Reason and Message fields.

func GetTopLevelCondition

func GetTopLevelCondition(target Getter) *metav1.Condition

GetTopLevelCondition finds and returns the top level condition (Ready Condition).

func InitializeConditions

func InitializeConditions(target Setter, types ...string) (changed bool)

InitializeConditions updates all conditions to Unknown if not set.

func IsReady

func IsReady(target Getter) bool

IsReady looks at the v1alpha1.ReadyCondition condition type and returns true if that condition is set to true and the observed generation matches the object's generation.

func RecomputeReady

func RecomputeReady(target Setter) (changed bool)

RecomputeReady recomputes the Ready Condition based on all other conditions. It sets the Ready Condition to false if any other condition is not ready, or to true if all other conditions are ready.

func Set

func Set(target Setter, condition metav1.Condition) (changed bool)

Set adds or updates a condition on the target object. It returns true if the condition was changed, false otherwise.

func Sort

func Sort(conditions []metav1.Condition)

Sort sorts the given conditions slice in place. The Ready condition is sorted to the top, followed by other conditions in alphabetical order of their type.

Types

type Getter

type Getter interface {
	// GetConditions returns the list of conditions for an API object.
	GetConditions() []metav1.Condition
}

Getter defines methods that an API object should implement in order to use the conditions package for getting conditions.

type Setter

type Setter interface {
	Getter
	// SetConditions sets conditions for an API object.
	SetConditions([]metav1.Condition)
}

Setter defines methods that an API object should implement in order to use the conditions package for setting conditions.

Jump to

Keyboard shortcuts

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