external

package
v1.11.3 Latest Latest
Warning

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

Go to latest
Published: Nov 3, 2025 License: Apache-2.0 Imports: 24 Imported by: 48

Documentation

Overview

Package external implements external controller types.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateFromTemplate added in v1.3.0

CreateFromTemplate uses the client and the reference to create a new object from the template.

func Delete added in v0.4.3

Delete uses the client and reference to delete an external, unstructured object.

func FailuresFrom added in v0.3.0

func FailuresFrom(obj *unstructured.Unstructured) (string, string, error)

FailuresFrom returns the FailureReason and FailureMessage fields from the external object status.

func GenerateTemplate added in v0.3.3

func GenerateTemplate(in *GenerateTemplateInput) (*unstructured.Unstructured, error)

GenerateTemplate generates an object with the given template input.

func Get

Get uses the client and reference to get an external, unstructured object.

func GetObjectFromContractVersionedRef added in v1.11.0

func GetObjectFromContractVersionedRef(ctx context.Context, c client.Reader, ref clusterv1.ContractVersionedObjectReference, namespace string) (*unstructured.Unstructured, error)

GetObjectFromContractVersionedRef uses the client and reference to get an external, unstructured object.

func IsReady

func IsReady(obj *unstructured.Unstructured) (bool, error)

IsReady returns true if the Status.Ready field on an external object is true.

Types

type CreateFromTemplateInput added in v1.3.0

type CreateFromTemplateInput struct {
	// Client is the controller runtime client.
	Client client.Client

	// TemplateRef is a reference to the template that needs to be cloned.
	TemplateRef *corev1.ObjectReference

	// Namespace is the Kubernetes namespace the cloned object should be created into.
	Namespace string

	// Name is used as the name of the generated object, if set.
	// If it isn't set the template name will be used as prefix to generate a name instead.
	Name string

	// ClusterName is the cluster this object is linked to.
	ClusterName string

	// OwnerRef is an optional OwnerReference to attach to the cloned object.
	// +optional
	OwnerRef *metav1.OwnerReference

	// Labels is an optional map of labels to be added to the object.
	// +optional
	Labels map[string]string

	// Annotations is an optional map of annotations to be added to the object.
	// +optional
	Annotations map[string]string
}

CreateFromTemplateInput is the input to CreateFromTemplate.

type GenerateTemplateInput added in v0.3.3

type GenerateTemplateInput struct {
	// Template is the TemplateRef turned into an unstructured.
	Template *unstructured.Unstructured

	// TemplateRef is a reference to the template that needs to be cloned.
	TemplateRef *corev1.ObjectReference

	// Namespace is the Kubernetes namespace the cloned object should be created into.
	Namespace string

	// Name is used as the name of the generated object, if set.
	// If it isn't set the template name will be used as prefix to generate a name instead.
	Name string

	// ClusterName is the cluster this object is linked to.
	ClusterName string

	// OwnerRef is an optional OwnerReference to attach to the cloned object.
	// +optional
	OwnerRef *metav1.OwnerReference

	// Labels is an optional map of labels to be added to the object.
	// +optional
	Labels map[string]string

	// Annotations is an optional map of annotations to be added to the object.
	// +optional
	Annotations map[string]string
}

GenerateTemplateInput is the input needed to generate a new template.

type ObjectTracker added in v0.3.0

type ObjectTracker struct {
	Controller      controller.Controller
	Cache           cache.Cache
	Scheme          *runtime.Scheme
	PredicateLogger *logr.Logger
	// contains filtered or unexported fields
}

ObjectTracker is a helper struct to deal when watching external unstructured objects.

func (*ObjectTracker) Watch added in v0.3.0

func (o *ObjectTracker) Watch(log logr.Logger, obj client.Object, handler handler.EventHandler, p ...predicate.Predicate) error

Watch uses the controller to issue a Watch only if the object hasn't been seen before.

type ReconcileOutput added in v0.3.0

type ReconcileOutput struct {
	// RequeueAfter if greater than 0, tells the Controller to requeue the reconcile key after the Duration.
	// Implies that Requeue is true, there is no need to set Requeue to true at the same time as RequeueAfter.
	//
	// TODO(vincepri): Remove this field here and try to return a better struct that embeds ctrl.Result,
	// we can't do that today because the field would conflict with the current `Result` field,
	// which should probably be renamed to `Object` or something similar.
	RequeueAfter time.Duration
	// Details of the referenced external object.
	// +optional
	Result *unstructured.Unstructured
}

ReconcileOutput is a return type of the external reconciliation of referenced objects.

Directories

Path Synopsis
Package fake provides a fake controllers for testing.
Package fake provides a fake controllers for testing.

Jump to

Keyboard shortcuts

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