api

package
v1.1.1 Latest Latest
Warning

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

Go to latest
Published: Nov 19, 2024 License: MIT Imports: 8 Imported by: 8

Documentation

Index

Constants

View Source
const (
	// TypeReady represents whether the resource has been successfully and completely processed.
	TypeReady ConditionType = "Ready"

	// TypeSynced resources are believed to be in sync with the
	// Kubernetes resources that manage their lifecycle.
	TypeSynced ConditionType = "Synced"

	// TypeReferencesValid indicates whether object references are valid (i.e. that they exist).
	TypeReferencesValid = "ReferencesValid"

	// ReasonReferencesExist is the reason that ReferencesValid is true.
	ReasonReferencesExist = "ReferencedObjectsExist"
)

Condition types.

Variables

This section is empty.

Functions

This section is empty.

Types

type ClusterObjectRef

type ClusterObjectRef struct {
	// Name of the object. Required.
	Name string `json:"name"`

	// Namespace of the object. Required.
	Namespace string `json:"namespace"`

	// ClusterID of the object. Required.
	ClusterID string `json:"clusterId"`
}

ClusterObjectRef references an object by name, namespace, and cluster. Used in multi-cluster APIs.

func (ClusterObjectRef) String

func (o ClusterObjectRef) String() string

String returns the ClusterObjectRef as a string

type Condition

type Condition struct {
	// Type of this condition. At most one of each condition type may apply to
	// a resource at any point in time.
	Type ConditionType `json:"type"`

	// Status of this condition; is it currently True, False, or Unknown?
	Status corev1.ConditionStatus `json:"status"`

	// ObservedGeneration is the .metadata.generation that the condition was set based on.
	// For instance, if .metadata.generation is currently 12, but the
	// .status.conditions[x].observedGeneration is 9, the condition is out of date with respect
	// to the current state of the instance.
	ObservedGeneration int64 `json:"observedGeneration,omitempty"`

	// LastTransitionTime is the last time this condition transitioned from one
	// status to another.
	LastTransitionTime metav1.Time `json:"lastTransitionTime"`

	// A Reason for this condition's last transition from one status to another.
	Reason ConditionReason `json:"reason"`

	// A Message containing details about this condition's last transition from
	// one status to another, if any.
	// +optional
	Message string `json:"message,omitempty"`
}

A Condition that may apply to a resource. +kubebuilder:object:generate=true

func Available

func Available() Condition

Available returns a condition indicating the resource is currently observed to be available for use.

func Creating

func Creating() Condition

Creating returns a condition indicating the resource is currently being created.

func Deleting

func Deleting() Condition

Deleting returns a condition indicating the resource is currently being deleted.

func ReconcileError

func ReconcileError(err error) Condition

ReconcileError returns a condition indicating that Crossplane encountered an error while reconciling the resource. This could mean Crossplane was unable to update the resource to reflect its desired state, or that Crossplane was unable to determine the current actual state of the resource.

func ReconcileSuccess

func ReconcileSuccess() Condition

ReconcileSuccess returns a condition indicating that Crossplane successfully completed the most recent reconciliation of the resource.

func ReferencesInvalid

func ReferencesInvalid(reason ConditionReason, missingRefs []ObjectRef) Condition

ReferencesInvalid returns a condition indicating that some object references are invalid, i.e. that they reference non-existent objects.

func ReferencesValid

func ReferencesValid() Condition

ReferencesValid returns a condition indicating that all object references are valid, i.e. that the referenced object exists.

func Unavailable

func Unavailable() Condition

Unavailable returns a condition indicating the resource is not currently available for use. Unavailable should be set only when Crossplane expects the resource to be available but knows it is not, for example because its API reports it is unhealthy.

func (*Condition) DeepCopy

func (in *Condition) DeepCopy() *Condition

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

func (*Condition) DeepCopyInto

func (in *Condition) DeepCopyInto(out *Condition)

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

func (Condition) Equal

func (c Condition) Equal(other Condition) bool

Equal returns true if the condition is identical to the supplied condition, ignoring the LastTransitionTime.

func (Condition) IsEmpty

func (c Condition) IsEmpty() bool

IsEmpty returns true if the condition is empty.

func (Condition) WithMessage

func (c Condition) WithMessage(msg string) Condition

WithMessage returns a condition by adding the provided message to existing condition.

type ConditionReason

type ConditionReason string

A ConditionReason represents the reason a resource is in a condition.

const (
	ReasonAvailable   ConditionReason = "Available"
	ReasonUnavailable ConditionReason = "Unavailable"
	ReasonCreating    ConditionReason = "Creating"
	ReasonDeleting    ConditionReason = "Deleting"
)

Reasons a resource is or is not ready.

const (
	ReasonReconcileSuccess ConditionReason = "ReconcileSuccess"
	ReasonReconcileError   ConditionReason = "ReconcileError"
)

Reasons a resource is or is not synced.

type ConditionType

type ConditionType string

A ConditionType represents a condition a resource could be in.

func (ConditionType) String

func (c ConditionType) String() string

String returns ConditionType as a string

type Conditioned

type Conditioned interface {
	// GetGeneration returns the `metadata.generation` of the Kubernetes resource on which these status conditions live.
	GetGeneration() int64
	// GetConditions returns the status conditions of the resource.
	GetConditions() []Condition
	// SetConditions sets the status conditions of the resource.
	SetConditions(c ...Condition)
	// GetCondition returns the status condition of the resource with the supplied type.
	GetCondition(ConditionType) Condition
}

A Conditioned may have conditions set or retrieved. Conditions indicate the status of a particular FSM state of a resource, or in the case of the condition of type "Ready", the overall status of the resource.

type ConditionedStatus

type ConditionedStatus struct {
	// Conditions of the resource.
	// +optional
	Conditions []Condition `json:"conditions,omitempty"`
}

A ConditionedStatus reflects the observed status of a resource. Only one condition of each type may exist. +kubebuilder:object:generate=true

func NewConditionedStatus

func NewConditionedStatus(c ...Condition) *ConditionedStatus

NewConditionedStatus returns a stat with the supplied conditions set.

func (*ConditionedStatus) DeepCopy

func (in *ConditionedStatus) DeepCopy() *ConditionedStatus

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

func (*ConditionedStatus) DeepCopyInto

func (in *ConditionedStatus) DeepCopyInto(out *ConditionedStatus)

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

func (*ConditionedStatus) Equal

func (s *ConditionedStatus) Equal(other *ConditionedStatus) bool

Equal returns true if the status is identical to the supplied status, ignoring the LastTransitionTimes and order of statuses.

func (*ConditionedStatus) GetCondition

func (s *ConditionedStatus) GetCondition(ct ConditionType) Condition

GetCondition returns the condition for the given ConditionType if exists, otherwise returns nil

func (*ConditionedStatus) GetConditions

func (s *ConditionedStatus) GetConditions() []Condition

GetConditions returns the condition for the given ConditionType if exists, otherwise returns nil

func (*ConditionedStatus) SetConditions

func (s *ConditionedStatus) SetConditions(c ...Condition)

SetConditions sets the supplied conditions, replacing any existing conditions of the same type. This is a no-op if all supplied conditions are identical, ignoring the last transition time, to those already set. TODO(harveyxia) since this is invoked often for the fsm controller frame, improve efficiency by using hash map to make this O(len(c)) instead of O(len(c)*len(s.Conditions))

type NamedObjectRef added in v1.1.1

type NamedObjectRef struct {
	// Name of the object. Required.
	Name string `json:"name"`

	// Namespace of the object. Optional. Defaulting behavior is determined by the parent API.
	Namespace string `json:"namespace,omitempty"`
}

NamedObjectRef references an object by name and optionally by namespace.

type ObjectRef

type ObjectRef struct {
	// Name of the object. Required.
	Name string `json:"name"`

	// Namespace of the object. Required.
	Namespace string `json:"namespace"`
}

ObjectRef references a namespace-scoped object by name and namespace.

func ObjectRefFrom

func ObjectRefFrom(o client.Object) *ObjectRef

ObjectRefFrom returns an *ObjectRef from a client.Object

func (ObjectRef) ObjectKey

func (o ObjectRef) ObjectKey() client.ObjectKey

ObjectKey returns the ObjectRef as a client.ObjectKey

type TypedObjectRef

type TypedObjectRef struct {

	// Group of the object. Required.
	Group string `json:"group"`

	// Version of the object. Required.
	Version string `json:"version"`

	// Kind of the object. Required.
	Kind string `json:"kind"`

	// Name of the object. Required.
	Name string `json:"name"`

	// Namespace of the object. Required.
	Namespace string `json:"namespace"`
}

TypedObjectRef references an object by name and namespace and includes its Group, Version, and Kind.

func (TypedObjectRef) GroupVersionKind

func (t TypedObjectRef) GroupVersionKind() schema.GroupVersionKind

func (TypedObjectRef) ObjectKey

func (t TypedObjectRef) ObjectKey() client.ObjectKey

func (TypedObjectRef) ObjectKeyNotSet

func (t TypedObjectRef) ObjectKeyNotSet() bool

func (TypedObjectRef) String

func (t TypedObjectRef) String() string

func (TypedObjectRef) ToCoreV1ObjectReference

func (t TypedObjectRef) ToCoreV1ObjectReference() *corev1.ObjectReference

ToCoreV1ObjectReference is a convenience method that returns a *corev1.ObjectReference with a subset of fields populated.

Jump to

Keyboard shortcuts

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