apis

package
v0.21.0 Latest Latest
Warning

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

Go to latest
Published: Aug 15, 2024 License: Apache-2.0 Imports: 7 Imported by: 12

Documentation

Index

Constants

View Source
const (
	// ConditionReady specifies that the resource is ready.
	// For long-running resources.
	ConditionReady = "Ready"
	// ConditionSucceeded specifies that the resource has finished.
	// For resource which run to completion.
	ConditionSucceeded = "Succeeded"
)

Variables

This section is empty.

Functions

func ConditionIsFalse

func ConditionIsFalse(c *metav1.Condition) bool

ConditionIsFalse returns true if the condition's status is False

func ConditionIsTrue

func ConditionIsTrue(c *metav1.Condition) bool

ConditionIsTrue returns true if the condition's status is True

func ConditionIsUnknown

func ConditionIsUnknown(c *metav1.Condition) bool

ConditionIsUnknown returns true if the condition's status is Unknown or not known

Types

type ConditionManager

type ConditionManager interface {
	// IsHappy looks at the happy condition and returns true if that condition is
	// set to true.
	IsHappy() bool

	// GetCondition finds and returns the Condition that matches the ConditionType
	// previously set on Conditions.
	GetCondition(t string) *metav1.Condition

	// SetCondition sets or updates the Condition on Conditions for Condition.Type.
	// If there is an update, Conditions are stored back sorted.
	SetCondition(new metav1.Condition)

	// ClearCondition removes the non terminal condition that matches the ConditionType
	ClearCondition(t string) error

	// MarkTrue sets the status of t to true, and then marks the happy condition to
	// true if all dependents are true.
	MarkTrue(t string, reason, messageFormat string, messageA ...interface{})

	// MarkUnknown sets the status of t to Unknown and also sets the happy condition
	// to Unknown if no other dependent condition is in an error state.
	MarkUnknown(t string, reason, messageFormat string, messageA ...interface{})

	// MarkFalse sets the status of t and the happy condition to False.
	MarkFalse(t string, reason, messageFormat string, messageA ...interface{})

	// InitializeConditions updates all Conditions in the ConditionSet to Unknown
	// if not set.
	InitializeConditions()
}

ConditionManager allows a resource to operate on its Conditions using higher order operations.

type ConditionSet

type ConditionSet struct {
	// contains filtered or unexported fields
}

ConditionSet is an abstract collection of the possible ConditionType values that a particular resource might expose. It also holds the "happy condition" for that resource, which we define to be one of Ready or Succeeded depending on whether it is a Living or Batch process respectively.

func NewBatchConditionSet

func NewBatchConditionSet(d ...string) ConditionSet

NewBatchConditionSet returns a ConditionSet to hold the conditions for the batch resource. ConditionSucceeded is used as the happy condition. The set of condition types provided are those of the terminal subconditions.

func NewBatchConditionSetWithHappyReason

func NewBatchConditionSetWithHappyReason(happyReason string, d ...string) ConditionSet

NewBatchConditionSetWithHappyReason returns a ConditionSet to hold the conditions for the batch resource. ConditionSucceeded is used as the happy condition with the provided happy reason. The set of condition types provided are those of the terminal subconditions.

func NewLivingConditionSet

func NewLivingConditionSet(d ...string) ConditionSet

NewLivingConditionSet returns a ConditionSet to hold the conditions for the living resource. ConditionReady is used as the happy condition. The set of condition types provided are those of the terminal subconditions.

func NewLivingConditionSetWithHappyReason

func NewLivingConditionSetWithHappyReason(happyReason string, d ...string) ConditionSet

NewLivingConditionSetWithHappyReason returns a ConditionSet to hold the conditions for the living resource. ConditionReady is used as the happy condition with the provided happy reason. The set of condition types provided are those of the terminal subconditions.

func (ConditionSet) Manage deprecated

Deprecated: use ManageWithContext Manage creates a ConditionManager from an accessor object using the original ConditionSet as a reference. Status must be a pointer to a struct.

func (ConditionSet) ManageWithContext

func (r ConditionSet) ManageWithContext(ctx context.Context, status ConditionsAccessor) ConditionManager

Manage creates a ConditionManager from an accessor object using the original ConditionSet as a reference. Status must be a pointer to a struct.

type ConditionsAccessor

type ConditionsAccessor interface {
	GetConditions() []metav1.Condition
	SetConditions([]metav1.Condition)
}

ConditionsAccessor is the interface for a Resource that implements the getter and setter for accessing a Condition collection.

type Status

type Status struct {
	// ObservedGeneration is the 'Generation' of the resource that
	// was last processed by the controller.
	// +optional
	ObservedGeneration int64 `json:"observedGeneration,omitempty"`

	// Conditions the latest available observations of a resource's current state.
	// +optional
	// +patchMergeKey=type
	// +patchStrategy=merge
	Conditions []metav1.Condition `json:"conditions,omitempty" patchStrategy:"merge" patchMergeKey:"type"`
}

Status is the minimally expected status subresource. Use this or provide your own. It also shows how Conditions are expected to be embedded in the Status field.

Example:

type MyResourceStatus struct {
	apis.Status `json:",inline"`
	UsefulMessage string `json:"usefulMessage,omitempty"`
}

WARNING: Adding fields to this struct will add them to all resources. +k8s:deepcopy-gen=true

func (*Status) DeepCopy

func (in *Status) DeepCopy() *Status

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Status.

func (*Status) DeepCopyInto

func (in *Status) DeepCopyInto(out *Status)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*Status) GetCondition

func (s *Status) GetCondition(t string) *metav1.Condition

GetCondition fetches the condition of the specified type.

func (*Status) GetConditions

func (s *Status) GetConditions() []metav1.Condition

GetConditions implements ConditionsAccessor

func (*Status) SetConditions

func (s *Status) SetConditions(c []metav1.Condition)

SetConditions implements ConditionsAccessor

Jump to

Keyboard shortcuts

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