conditions

package
v0.1.0-latest-stable Latest Latest
Warning

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

Go to latest
Published: Sep 30, 2026 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MessageNotReady = "The following conditions are not ready"
)

Variables

This section is empty.

Functions

func AddFalse

func AddFalse(obj GetSet, conditionType ConditionType, conditionReason ConditionReason, conditionMessage ConditionMessage)

AddFalse adds a condition with Status=False, Reason=Pending and a specified message.

func AddTrue

func AddTrue(obj GetSet, conditionType ConditionType)

AddTrue adds a condition with Status=True, Reason=Successful and Message=Reconciliation successful.

func EnsureConditions

func EnsureConditions(obj GetSet, allConditions []ConditionType)

EnsureConditions ensures that all specified conditions are present. allConditions can be left nil if no conditions must be initialized.

func Get

func Get(obj GetSet, conditionType ConditionType) *metav1.Condition

Get returns a condition with a specific type.

func IsPending

func IsPending(c *metav1.Condition) bool

IsPending returns true if the condition has Reason=Pending and Status=Unknown, indicating a transient state that is expected to resolve on its own.

func IsTrue

func IsTrue(obj GetSet, conditionType ConditionType) bool

func JoinErrors

func JoinErrors(err error, indent int) error

func NewCondition

func NewCondition(condType, reason, message string, status metav1.ConditionStatus) metav1.Condition

NewCondition creates a new condition with the given parameters. This is a convenience builder to reduce boilerplate when creating conditions.

func NewFalseCondition

func NewFalseCondition(condType, reason, message string) metav1.Condition

NewFalseCondition creates a condition with Status=False.

func NewTrueCondition

func NewTrueCondition(condType, reason, message string) metav1.Condition

NewTrueCondition creates a condition with Status=True.

func NewUnknownCondition

func NewUnknownCondition(condType, reason, message string) metav1.Condition

NewUnknownCondition creates a condition with Status=Unknown.

func ReadyConditionMessage

func ReadyConditionMessage(message string, unreadyConditions []string) string

func SetSummary

func SetSummary(obj GetSet)

SetSummary sets the overall controller condition and add a summary to the message. If we have: - only ready conditions, the reason is Success. - unready conditions, the reason will be Pending. - failed conditions, the reason is Failure. - one of the conditions is in deletion, the reason is AwaitingDeletion

func TypesAsStrings

func TypesAsStrings(conditionsTypes []ConditionType) []string

Types

type ConditionMessage

type ConditionMessage string

ConditionMessage is the message type for the conditions.

type ConditionReason

type ConditionReason string

ConditionReason is the type for the reason of a condition.

const (
	// ReasonAwaitingDeletion if the controller is waiting for the deletion.
	ReasonAwaitingDeletion ConditionReason = "AwaitingDeletion"
	// ReasonPending indicates that the resource has not yet reached the expected state.
	ReasonPending ConditionReason = "Pending"
	// ReasonError is an error the system CAN recover from.
	ReasonError ConditionReason = "Error"
	// ReasonFailure is a terminal state the system CANNOT recover from.
	ReasonFailure ConditionReason = "Failure"
	// ReasonSuccess is the success reason.
	ReasonSuccess ConditionReason = "Success"
	// ReasonRetrying indicates that the operation is being retried after a failure.
	ReasonRetrying ConditionReason = "Retrying"
)

type ConditionType

type ConditionType string

ConditionType represents different types of conditions in the conditions pkg. There are generally three types of conditions:

  • Ready: A singleton type indicating the overall status of the controller. Possible reasons include: Success, Failure, Pending, or AwaitingDeletion.

  • XXXReady: Indicates the readiness status of specific resources managed by the controller. Possible reasons include: Success, Failure, Pending, or AwaitingDeletion.

  • XXXReconciled: Reflects the status of the reconciliation process, indicating that changes to the resource have been applied. Possible reasons include: Success, Error, Pending, or AwaitingDeletion.

const (
	// TypeReady is the overall ready type for the controller.
	TypeReady ConditionType = "Ready"
)

type GetSet

type GetSet interface {
	GetConditions() []metav1.Condition
	SetConditions([]metav1.Condition)
	GetGeneration() int64
}

Jump to

Keyboard shortcuts

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