core

package
v1.19.0 Latest Latest
Warning

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

Go to latest
Published: Aug 13, 2024 License: Apache-2.0 Imports: 33 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// NsReconcilerPrefix is the prefix used for all Namespace reconcilers.
	NsReconcilerPrefix = "ns-reconciler"
	// RootReconcilerPrefix is the prefix usef for all Root reconcilers.
	RootReconcilerPrefix = "root-reconciler"
)

Variables

View Source
var Scheme = scheme.Scheme

Scheme is a reference to the global scheme. Use this Scheme to ensure you have all the required types added.

Functions

func AddAnnotations added in v1.16.1

func AddAnnotations(obj Annotated, annotations map[string]string)

AddAnnotations adds the specified annotations to the object.

func AddLabels added in v1.16.1

func AddLabels(obj Labeled, labels map[string]string)

AddLabels adds the specified labels to the object.

func GKNN

func GKNN(o client.Object) string

GKNN is used to set and verify the `configsync.gke.io/resource-id` annotation. Changing this function should be avoided, since it may introduce incompability across different Config Sync versions.

func GKNNs

func GKNNs(objs []client.Object) []string

GKNNs returns the `configsync.gke.io/resource-id` annotations of th given objects as a string slice in increasing order.

func GetAnnotation

func GetAnnotation(obj Annotated, annotation string) string

GetAnnotation gets the annotation value on the passed annotated object for a given key.

func GetLabel

func GetLabel(obj Labeled, label string) string

GetLabel gets the label value on the passed object for a given key.

func NsReconcilerName

func NsReconcilerName(namespace, name string) string

NsReconcilerName returns the namespace reconciler's name in the format: ns-reconciler-<namespace>-<name>-<name-length> If the RepoSync name is "repo-sync", it returns "ns-reconciler-<namespace>" for backward compatibility.

func NsReconcilerObjectKey added in v1.16.0

func NsReconcilerObjectKey(namespace, syncName string) client.ObjectKey

NsReconcilerObjectKey returns an ObjectKey for interracting with the NsReconciler for the specified RepoSync.

func ObjectNamespacedName

func ObjectNamespacedName(obj metav1.Object) types.NamespacedName

ObjectNamespacedName returns the NamespacedName of the object.

func RemoveAnnotations

func RemoveAnnotations(obj Annotated, annotations ...string)

RemoveAnnotations removes the passed set of annotations from obj.

func RemoveLabels added in v1.19.0

func RemoveLabels(obj Labeled, labels ...string)

RemoveLabels removes the passed set of labels from obj.

func RootReconcilerName

func RootReconcilerName(name string) string

RootReconcilerName returns the root reconciler's name in the format root-reconciler-<name>. If the RootSync name is "root-sync", it returns "root-reconciler" for backward compatibility.

func RootReconcilerObjectKey added in v1.16.0

func RootReconcilerObjectKey(syncName string) client.ObjectKey

RootReconcilerObjectKey returns an ObjectKey for interacting with the RootReconciler for the specified RootSync.

func RootSyncName added in v1.17.0

func RootSyncName(reconcilerName string) string

RootSyncName returns the RootSync's name given the name of its reconciler. It is the inverse of RootReconcilerName

func SetAnnotation

func SetAnnotation(obj Annotated, annotation, value string)

SetAnnotation sets the annotation on the passed annotated object to value.

func SetLabel

func SetLabel(obj Labeled, label, value string)

SetLabel sets label on obj to value.

Types

type Annotated

type Annotated interface {
	GetAnnotations() map[string]string
	SetAnnotations(annotations map[string]string)
}

Annotated is the interface defined by types with annotations. Note that some non-objects (such as PodTemplates) define annotations but are not objects.

type ID

type ID struct {
	schema.GroupKind
	client.ObjectKey
}

ID uniquely identifies a resource on an API Server.

func IDOf

func IDOf(o client.Object) ID

IDOf converts an Object to its ID.

func (ID) String

func (i ID) String() string

String implements fmt.Stringer.

type Labeled

type Labeled interface {
	GetLabels() map[string]string
	SetLabels(annotations map[string]string)
}

Labeled is the interface defined by types with labeled. Note that some non-objects (such as PodTemplates) define labels but are not objects.

type MetaMutator

type MetaMutator func(o client.Object)

MetaMutator is a Mutator that modifies the metadata of an Object.

func Annotation

func Annotation(annotation, value string) MetaMutator

Annotation adds annotation=value to the metadata.annotations of the MetaObject under test.

func Annotations

func Annotations(annotations map[string]string) MetaMutator

Annotations sets the object's annotations to a copy of the passed map. Setting to nil causes a call to SetAnnotations(nil), but the underlying implementation may set Annotations to empty map.

func CreationTimeStamp

func CreationTimeStamp(ts metav1.Time) MetaMutator

CreationTimeStamp sets the object's creation time stamp to the given value.

func DeletionGracePeriod

func DeletionGracePeriod(seconds int64) MetaMutator

DeletionGracePeriod sets the object's deletion grace period to the given value.

func DeletionTimestamp

func DeletionTimestamp(ts metav1.Time) MetaMutator

DeletionTimestamp sets the object's deletion timestamp to the given value.

func GenerateName added in v1.17.0

func GenerateName(generateName string) MetaMutator

GenerateName replaces the metadata.generateName of the Object under test.

func Generation

func Generation(gen int64) MetaMutator

Generation replaces the metadata.generation of the Object under test.

func Label

func Label(label, value string) MetaMutator

Label adds label=value to the metadata.labels of the Object under test.

func Labels

func Labels(labels map[string]string) MetaMutator

Labels sets the object's labels to a copy of the passed map. Setting to nil causes a call to SetLabels(nil), but the underlying implementation may set Labels to empty map.

func Name

func Name(name string) MetaMutator

Name replaces the metadata.name of the Object under test.

func Namespace

func Namespace(namespace string) MetaMutator

Namespace replaces the metadata.namespace of the Object under test.

func OwnerReference

func OwnerReference(or []metav1.OwnerReference) MetaMutator

OwnerReference sets the object's owner references to a passed slice of metav1.OwnerReference.

func ResourceVersion

func ResourceVersion(version string) MetaMutator

ResourceVersion sets the object's resource version to the given value.

func SelfLink(selfLink string) MetaMutator

SelfLink sets the object's self link to the given value.

func UID

func UID(uid types.UID) MetaMutator

UID replaces the metadata.uid of the Object under test.

func WithoutAnnotation

func WithoutAnnotation(annotation string) MetaMutator

WithoutAnnotation removes annotation from metadata.annotations of the MetaObject under test.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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