external

package
v1.6.3 Latest Latest
Warning

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

Go to latest
Published: Mar 12, 2024 License: Apache-2.0 Imports: 20 Imported by: 33

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

func CreateFromTemplate(ctx context.Context, in *CreateFromTemplateInput) (*corev1.ObjectReference, error)

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 GetObjectReference added in v0.3.3

func GetObjectReference(obj *unstructured.Unstructured) *corev1.ObjectReference

GetObjectReference converts an unstructured into object reference.

func IsInitialized added in v0.3.0

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

IsInitialized returns true if the Status.Initialized field on an external object is true.

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

	// 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

	// 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
	// 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 runtime.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
	// Indicates if the external object is paused.
	// +optional
	Paused bool
}

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

Jump to

Keyboard shortcuts

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