meta

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: May 22, 2024 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Overview

Package meta contains functions for dealing with Kubernetes object metadata.

Index

Constants

View Source
const (
	// AnnotationKeyExternalName is the key in the annotations map of a
	// resource for the name of the resource as it appears on provider's
	// systems.
	AnnotationKeyExternalName = "crossplane.io/external-name"

	// AnnotationKeyExternalCreatePending is the key in the annotations map
	// of a resource that indicates the last time creation of the external
	// resource was pending (i.e. about to happen). Its value must be an
	// RFC3999 timestamp.
	AnnotationKeyExternalCreatePending = "crossplane.io/external-create-pending"

	// AnnotationKeyExternalCreateSucceeded is the key in the annotations
	// map of a resource that represents the last time the external resource
	// was created successfully. Its value must be an RFC3339 timestamp,
	// which can be used to determine how long ago a resource was created.
	// This is useful for eventually consistent APIs that may take some time
	// before the API called by Observe will report that a recently created
	// external resource exists.
	AnnotationKeyExternalCreateSucceeded = "crossplane.io/external-create-succeeded"

	// AnnotationKeyExternalCreateFailed is the key in the annotations map
	// of a resource that indicates the last time creation of the external
	// resource failed. Its value must be an RFC3999 timestamp.
	AnnotationKeyExternalCreateFailed = "crossplane.io/external-create-failed"

	// AnnotationKeyReconciliationPaused is the key in the annotations map
	// of a resource that indicates that further reconciliations on the
	// resource are paused. All create/update/delete/generic events on
	// the resource will be filtered and thus no further reconcile requests
	// will be queued for the resource.
	AnnotationKeyReconciliationPaused = "crossplane.io/paused"
)
View Source
const (
	AnnotationKeyPropagateToPrefix = "to.propagate.crossplane.io/"

	// Deprecated: This functionality will be removed soon.
	AnnotationKeyPropagateFromNamespace = "from.propagate.crossplane.io/namespace"
	AnnotationKeyPropagateFromName      = "from.propagate.crossplane.io/name"
)

Supported resources with all of these annotations will be fully or partially propagated to the named resource of the same kind, assuming it exists and consents to propagation.

Variables

This section is empty.

Functions

func AddAnnotations

func AddAnnotations(o metav1.Object, annotations map[string]string)

AddAnnotations to the supplied object.

func AddControllerReference

func AddControllerReference(o metav1.Object, r metav1.OwnerReference) error

AddControllerReference to the supplied object's metadata. Any existing owner with the same UID as the supplied reference will be replaced. Returns an error if the supplied object is already controlled by a different owner.

func AddFinalizer

func AddFinalizer(o metav1.Object, finalizer string)

AddFinalizer to the supplied Kubernetes object's metadata.

func AddLabels

func AddLabels(o metav1.Object, labels map[string]string)

AddLabels to the supplied object.

func AddOwnerReference

func AddOwnerReference(o metav1.Object, r metav1.OwnerReference)

AddOwnerReference to the supplied object' metadata. Any existing owner with the same UID as the supplied reference will be replaced.

func AllowPropagation

func AllowPropagation(from, to metav1.Object)

AllowPropagation from one object to another by adding consenting annotations to both. Deprecated: This functionality will be removed soon.

func AllowsPropagationFrom

func AllowsPropagationFrom(to metav1.Object) types.NamespacedName

AllowsPropagationFrom returns the NamespacedName of the object the supplied object should be propagated from.

func AllowsPropagationTo

func AllowsPropagationTo(from metav1.Object) map[types.NamespacedName]bool

AllowsPropagationTo returns the set of NamespacedNames that the supplied object may be propagated to.

func AnnotationKeyPropagateTo

func AnnotationKeyPropagateTo(o metav1.Object) string

AnnotationKeyPropagateTo returns an annotation key whose presence indicates that the annotated object consents to propagation from the supplied object. The annotation name (which follows the prefix) can be anything that doesn't collide with another annotation. to.propagation.crossplane.io/example would be valid. This function uses a hash of the supplied object's namespace and name in order to avoid collisions and keep the suffix relatively short.

func AsController

func AsController(r *xpv1.TypedReference) metav1.OwnerReference

AsController converts the supplied object reference to a controller reference. You may also consider using metav1.NewControllerRef.

func AsOwner

AsOwner converts the supplied object reference to an owner reference.

func ExternalCreateIncomplete

func ExternalCreateIncomplete(o metav1.Object) bool

ExternalCreateIncomplete returns true if creation of the external resource appears to be incomplete. We deem creation to be incomplete if the 'external create pending' annotation is the newest of all tracking annotations that are set (i.e. pending, succeeded, and failed).

func ExternalCreateSucceededDuring

func ExternalCreateSucceededDuring(o metav1.Object, d time.Duration) bool

ExternalCreateSucceededDuring returns true if creation of the external resource that corresponds to the supplied managed resource succeeded within the supplied duration.

func FinalizerExists

func FinalizerExists(o metav1.Object, finalizer string) bool

FinalizerExists checks whether given finalizer is already set.

func GetExternalCreateFailed

func GetExternalCreateFailed(o metav1.Object) time.Time

GetExternalCreateFailed returns the time at which the external resource recently failed to create.

func GetExternalCreatePending

func GetExternalCreatePending(o metav1.Object) time.Time

GetExternalCreatePending returns the time at which the external resource was most recently pending creation.

func GetExternalCreateSucceeded

func GetExternalCreateSucceeded(o metav1.Object) time.Time

GetExternalCreateSucceeded returns the time at which the external resource was most recently created.

func GetExternalName

func GetExternalName(o metav1.Object) string

GetExternalName returns the external name annotation value on the resource.

func HaveSameController

func HaveSameController(a, b metav1.Object) bool

HaveSameController returns true if both supplied objects are controlled by the same object.

func IsPaused

func IsPaused(o metav1.Object) bool

IsPaused returns true if the object has the AnnotationKeyReconciliationPaused annotation set to `true`.

func NamespacedNameOf

func NamespacedNameOf(r *corev1.ObjectReference) types.NamespacedName

NamespacedNameOf returns the referenced object's namespaced name.

func ReferenceTo

ReferenceTo returns an object reference to the supplied object, presumed to be of the supplied group, version, and kind. Deprecated: use a more specific reference type, such as TypedReference or Reference instead of the overly verbose ObjectReference. See https://github.com/marcosQuesada/crossplane-runtime/issues/49

func RemoveAnnotations

func RemoveAnnotations(o metav1.Object, annotations ...string)

RemoveAnnotations with the supplied keys from the supplied object.

func RemoveFinalizer

func RemoveFinalizer(o metav1.Object, finalizer string)

RemoveFinalizer from the supplied Kubernetes object's metadata.

func RemoveLabels

func RemoveLabels(o metav1.Object, labels ...string)

RemoveLabels with the supplied keys from the supplied object.

func SetExternalCreateFailed

func SetExternalCreateFailed(o metav1.Object, t time.Time)

SetExternalCreateFailed sets the time at which the external resource most recently failed to create.

func SetExternalCreatePending

func SetExternalCreatePending(o metav1.Object, t time.Time)

SetExternalCreatePending sets the time at which the external resource was most recently pending creation to the supplied time.

func SetExternalCreateSucceeded

func SetExternalCreateSucceeded(o metav1.Object, t time.Time)

SetExternalCreateSucceeded sets the time at which the external resource was most recently created to the supplied time.

func SetExternalName

func SetExternalName(o metav1.Object, name string)

SetExternalName sets the external name annotation of the resource.

func TypedReferenceTo

func TypedReferenceTo(o metav1.Object, of schema.GroupVersionKind) *xpv1.TypedReference

TypedReferenceTo returns a typed object reference to the supplied object, presumed to be of the supplied group, version, and kind.

func WasCreated

func WasCreated(o metav1.Object) bool

WasCreated returns true if the supplied object was created in the API server.

func WasDeleted

func WasDeleted(o metav1.Object) bool

WasDeleted returns true if the supplied object was deleted from the API server.

Types

This section is empty.

Jump to

Keyboard shortcuts

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