kstatus

package
v0.0.0-...-4b36f7d Latest Latest
Warning

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

Go to latest
Published: May 5, 2024 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	StatusTrue  = "True"
	StatusFalse = "False"
)

Variables

View Source
var EmptyCondition = metav1.Condition{}

Functions

func CreateCondition

func CreateCondition(conditions []metav1.Condition, condition metav1.Condition, unsetReason string) []metav1.Condition

CreateCondition sets a condition only if it has not already been set

func GetCondition

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

func InvertStatus

func InvertStatus(status metav1.ConditionStatus) metav1.ConditionStatus

InvertStatus returns the opposite of the provided status. If an invalid status is passed in, False is returned

func UpdateConditionIfChanged

func UpdateConditionIfChanged(conditions []metav1.Condition, condition metav1.Condition) []metav1.Condition

UpdateConditionIfChanged updates a condition if it has been changed.

Types

type WrappedStatus

type WrappedStatus struct {
	// Status is the object that is wrapped.
	config.Status
	// Dirty indicates if this object has been modified at all.
	// Note: only changes wrapped in Mutate are tracked.
	Dirty bool
}

WrappedStatus provides a wrapper around a status message that keeps track of whether or not any changes have been made. This allows users to declarative write status, without worrying about tracking changes. When read to commit (typically to Kubernetes), any messages with Dirty=false can be discarded.

func Wrap

func Wrap(s config.Status) *WrappedStatus

func (*WrappedStatus) Mutate

func (w *WrappedStatus) Mutate(f func(s config.Status) config.Status)

func (*WrappedStatus) Unwrap

func (w *WrappedStatus) Unwrap() config.Status

Jump to

Keyboard shortcuts

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