common

package
v0.11.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Condition

type Condition struct {
	Type   ConditionType          `json:"type"`
	Status corev1.ConditionStatus `json:"status"`
	// +optional
	Reason ConditionReason `json:"reason,omitempty"`
	// +optional
	Message string `json:"message,omitempty"`
	// +optional
	LastTransitionTime metav1.Time `json:"lastTransitionTime,omitempty"`
}

Condition represents an observation of an object's state. Conditions are an extension mechanism intended to be used when the details of an observation are not a priori known or would not apply to all instances of a given Kind.

Conditions should be added to explicitly convey properties that users and components care about rather than requiring those properties to be inferred from other observations. Once defined, the meaning of a Condition can not be changed arbitrarily - it becomes part of the API, and has the same backwards- and forwards-compatibility concerns of any other part of the API.

func (*Condition) DeepCopyInto

func (c *Condition) DeepCopyInto(cpy *Condition)

DeepCopyInto copies in into out.

func (Condition) IsFalse

func (c Condition) IsFalse() bool

IsFalse returns whether the condition status is "False".

func (Condition) IsTrue

func (c Condition) IsTrue() bool

IsTrue Condition whether the condition status is "True".

func (Condition) IsUnknown

func (c Condition) IsUnknown() bool

IsUnknown returns whether the condition status is "Unknown".

type ConditionReason

type ConditionReason string

ConditionReason is intended to be a one-word, CamelCase representation of the category of cause of the current status. It is intended to be used in concise output, such as one-line kubectl get output, and in summarizing occurrences of causes.

type ConditionType

type ConditionType string

ConditionType is the type of the condition and is typically a CamelCased word or short phrase.

Condition types should indicate state in the "abnormal-true" polarity. For example, if the condition indicates when a policy is invalid, the "is valid" case is probably the norm, so the condition should be called "Invalid".

type Conditions

type Conditions []Condition

Conditions is a set of Condition instances.

func NewConditions

func NewConditions(conds ...Condition) Conditions

NewConditions initializes a set of conditions with the given list of conditions.

func (Conditions) Copy

func (conditions Conditions) Copy() Conditions

func (Conditions) GetCondition

func (conditions Conditions) GetCondition(t ConditionType) *Condition

GetCondition searches the set of conditions for the condition with the given ConditionType and returns it. If the matching condition is not found, GetCondition returns nil.

func (Conditions) IsFalseFor

func (conditions Conditions) IsFalseFor(t ConditionType) bool

IsFalseFor searches the set of conditions for a condition with the given ConditionType. If found, it returns `condition.IsFalse()`. If not found, it returns false.

func (Conditions) IsTrueFor

func (conditions Conditions) IsTrueFor(t ConditionType) bool

IsTrueFor searches the set of conditions for a condition with the given ConditionType. If found, it returns `condition.IsTrue()`. If not found, it returns false.

func (Conditions) IsUnknownFor

func (conditions Conditions) IsUnknownFor(t ConditionType) bool

IsUnknownFor searches the set of conditions for a condition with the given ConditionType. If found, it returns `condition.IsUnknown()`. If not found, it returns true.

func (Conditions) MarshalJSON

func (conditions Conditions) MarshalJSON() ([]byte, error)

MarshalJSON marshals the set of conditions as a JSON array, sorted by condition type.

func (*Conditions) RemoveCondition

func (conditions *Conditions) RemoveCondition(t ConditionType) bool

RemoveCondition removes the condition with the given ConditionType from the conditions set. If no condition with that type is found, RemoveCondition returns without performing any action. If the passed condition type is not found in the set of conditions, RemoveCondition returns false.

func (*Conditions) SetCondition

func (conditions *Conditions) SetCondition(newCond Condition) bool

SetCondition adds (or updates) the set of conditions with the given condition. It returns a boolean value indicating whether the set condition is new or was a change to the existing condition with the same type.

Jump to

Keyboard shortcuts

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