resource

package
v0.10.2 Latest Latest
Warning

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

Go to latest
Published: Nov 17, 2025 License: Apache-2.0 Imports: 12 Imported by: 12

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetConfigMapValue

func GetConfigMapValue(ctx context.Context, kube client.Client, ref *commonv1.ConfigMapKeySelector) (string, error)

func Ignore

func Ignore(is ErrorIs, err error) error

Ignore any errors that satisfy the supplied ErrorIs function by returning nil. Errors that do not satisfy the supplied function are returned unmodified.

func IgnoreAny

func IgnoreAny(err error, is ...ErrorIs) error

IgnoreAny ignores errors that satisfy any of the supplied ErrorIs functions by returning nil. Errors that do not satisfy any of the supplied functions are returned unmodified.

func IgnoreNotFound

func IgnoreNotFound(err error) error

IgnoreNotFound returns the supplied error, or nil if the error indicates a Kubernetes resource was not found.

func IsAPIError

func IsAPIError(err error) bool

IsAPIError returns true if the given error's type is of Kubernetes API error.

func IsAPIErrorWrapped

func IsAPIErrorWrapped(err error) bool

IsAPIErrorWrapped returns true if err is a K8s API error, or recursively wraps a K8s API error

func IsMissingReference

func IsMissingReference(err error) bool

IsMissingReference returns true if an error indicates that a managed resource is missing a required reference..

func MustCreateObject

func MustCreateObject(kind schema.GroupVersionKind, oc runtime.ObjectCreater) runtime.Object

MustCreateObject returns a new Object of the supplied kind. It panics if the kind is unknown to the supplied ObjectCreator.

Types

type APIFinalizer

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

An APIFinalizer adds and removes finalizers to and from a resource.

func NewAPIFinalizer

func NewAPIFinalizer(c client.Client, finalizer string) *APIFinalizer

NewAPIFinalizer returns a new APIFinalizer.

func (*APIFinalizer) AddFinalizer

func (a *APIFinalizer) AddFinalizer(ctx context.Context, obj Object) error

AddFinalizer to the supplied Managed resource.

func (*APIFinalizer) RemoveFinalizer

func (a *APIFinalizer) RemoveFinalizer(ctx context.Context, obj Object) error

RemoveFinalizer from the supplied Managed resource.

type AttributeReferencer

type AttributeReferencer interface {
	// GetStatus retries the referenced resource, as well as other non-managed
	// resources (like a `Provider`) and reports their readiness for use as a
	// referenced resource.
	GetStatus(ctx context.Context, res CanReference, r client.Reader) ([]ReferenceStatus, error)

	// Build retrieves the referenced resource, as well as other non-managed
	// resources (like a `Provider`), and builds the referenced attribute,
	// returning it as a string value.
	Build(ctx context.Context, res CanReference, r client.Reader) (value string, err error)

	// Assign accepts a managed resource object, and assigns the given value to
	// its corresponding property.
	Assign(res CanReference, value string) error
}

An AttributeReferencer resolves cross-resource attribute references. See https://github.com/crossplane/crossplane/blob/master/design/one-pager-cross-resource-referencing.md for more information

type CanReference

type CanReference runtime.Object

A CanReference is a resource that can reference another resource in its spec in order to automatically resolve corresponding spec field values by inspecting the referenced resource.

type Conditioned

type Conditioned interface {
	SetConditions(c ...prv1.Condition)
	GetCondition(prv1.ConditionType) prv1.Condition
}

A Conditioned may have conditions set or retrieved. Conditions are typically indicate the status of both a resource and its reconciliation process.

type Conditions

type Conditions []rtv1.Condition

func (Conditions) DeepCopy

func (cs Conditions) DeepCopy() Conditions

func (*Conditions) JoinConditions

func (cs *Conditions) JoinConditions(conds *Conditions)

func (*Conditions) RemoveCondition

func (cs *Conditions) RemoveCondition(ct rtv1.ConditionType)

func (*Conditions) UpsertCondition

func (cs *Conditions) UpsertCondition(cond rtv1.Condition)

func (*Conditions) UpsertConditionMessage

func (cs *Conditions) UpsertConditionMessage(cond rtv1.Condition)

type ErrorIs

type ErrorIs func(err error) bool

An ErrorIs function returns true if an error satisfies a particular condition.

type Finalizer

type Finalizer interface {
	AddFinalizer(ctx context.Context, obj Object) error
	RemoveFinalizer(ctx context.Context, obj Object) error
}

A Finalizer manages the finalizers on the resource.

func NewNopFinalizer

func NewNopFinalizer() Finalizer

NewNopFinalizer returns a Finalizer that does nothing.

type FinalizerFns

type FinalizerFns struct {
	AddFinalizerFn    func(ctx context.Context, obj Object) error
	RemoveFinalizerFn func(ctx context.Context, obj Object) error
}

A FinalizerFns satisfy the Finalizer interface.

func (FinalizerFns) AddFinalizer

func (f FinalizerFns) AddFinalizer(ctx context.Context, obj Object) error

AddFinalizer to the supplied resource.

func (FinalizerFns) RemoveFinalizer

func (f FinalizerFns) RemoveFinalizer(ctx context.Context, obj Object) error

RemoveFinalizer from the supplied resource.

type Managed

type Managed interface {
	Object
	Conditioned
}

A Managed is a Kubernetes object representing a concrete managed resource (e.g. a CloudSQL instance).

type ManagedKind

type ManagedKind schema.GroupVersionKind

A ManagedKind contains the type metadata for a kind of managed resource.

type ManagedList

type ManagedList interface {
	client.ObjectList

	// GetItems returns the list of managed resources.
	GetItems() []Managed
}

A ManagedList is a list of managed resources.

type Object

type Object interface {
	metav1.Object
	runtime.Object
}

An Object is a Kubernetes object.

type ReferenceStatus

type ReferenceStatus struct {
	Name   string
	Status ReferenceStatusType
}

ReferenceStatus has the name and status of a reference

func (ReferenceStatus) String

func (r ReferenceStatus) String() string

type ReferenceStatusType

type ReferenceStatusType int

ReferenceStatusType is an enum type for the possible values for a Reference Status

const (
	ReferenceStatusUnknown ReferenceStatusType = iota
	ReferenceNotFound
	ReferenceNotReady
	ReferenceReady
)

Reference statuses.

func (ReferenceStatusType) String

func (t ReferenceStatusType) String() string

Directories

Path Synopsis
Package fake provides fake Crossplane resources for use in tests.
Package fake provides fake Crossplane resources for use in tests.

Jump to

Keyboard shortcuts

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