Documentation ¶
Index ¶
- Variables
- func ConvertLabelKey(key string) string
- func ConvertLabelKeyWithPrefix(prefix, key string) string
- func DefaultPhysicalName(vName string, vObj client.Object) string
- func MergeLabelSelectors(elems ...*metav1.LabelSelector) *metav1.LabelSelector
- func ObjectPhysicalName(obj runtime.Object) string
- func PrintChanges(oldObject, newObject client.Object, log loghelper.Logger)
- func ResetObjectMetadata(obj metav1.Object)
- func Split(s, sep string) (string, string)
- func TranslateLabelSelector(labelSelector *metav1.LabelSelector) *metav1.LabelSelector
- func TranslateLabelSelectorCluster(physicalNamespace string, labelSelector *metav1.LabelSelector) *metav1.LabelSelector
- func TranslateLabelSelectorWithPrefix(labelPrefix string, labelSelector *metav1.LabelSelector) *metav1.LabelSelector
- func TranslateMetadata(physicalNamespace string, vObj client.Object, syncedLabels []string, ...) client.Object
- func TranslateMetadataUpdate(vObj client.Object, pObj client.Object, syncedLabels []string, ...) (bool, map[string]string, map[string]string)
- func UniqueSlice(stringSlice []string) []string
- type MetadataTranslator
- type NameTranslator
- type NamespacedTranslator
- type PhysicalNameTranslator
- type Translator
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ManagedAnnotationsAnnotation = "vcluster.loft.sh/managed-annotations" NamespaceAnnotation = "vcluster.loft.sh/object-namespace" NameAnnotation = "vcluster.loft.sh/object-name" LabelPrefix = "vcluster.loft.sh/label" )
Functions ¶
func ConvertLabelKey ¶
func MergeLabelSelectors ¶
func MergeLabelSelectors(elems ...*metav1.LabelSelector) *metav1.LabelSelector
func ObjectPhysicalName ¶
ObjectPhysicalName returns the translated physical name of this object
func PrintChanges ¶ added in v0.9.1
func ResetObjectMetadata ¶
ResetObjectMetadata resets the objects metadata except name, namespace and annotations
func TranslateLabelSelector ¶
func TranslateLabelSelector(labelSelector *metav1.LabelSelector) *metav1.LabelSelector
func TranslateLabelSelectorCluster ¶
func TranslateLabelSelectorCluster(physicalNamespace string, labelSelector *metav1.LabelSelector) *metav1.LabelSelector
func TranslateLabelSelectorWithPrefix ¶
func TranslateLabelSelectorWithPrefix(labelPrefix string, labelSelector *metav1.LabelSelector) *metav1.LabelSelector
func TranslateMetadata ¶
func TranslateMetadataUpdate ¶
func UniqueSlice ¶
Types ¶
type MetadataTranslator ¶
type MetadataTranslator interface { // TranslateMetadata translates the object's metadata TranslateMetadata(vObj client.Object) client.Object // TranslateMetadataUpdate translates the object's metadata annotations and labels and determines // if they have changed between the physical and virtual object TranslateMetadataUpdate(vObj client.Object, pObj client.Object) (changed bool, annotations map[string]string, labels map[string]string) }
MetadataTranslator is used to convert metadata between virtual and physical objects and vice versa
type NameTranslator ¶
type NameTranslator interface { // IsManaged determines if a physical object is managed by the vcluster IsManaged(pObj client.Object) (bool, error) // VirtualToPhysical translates a virtual name to a physical name VirtualToPhysical(req types.NamespacedName, vObj client.Object) types.NamespacedName // PhysicalToVirtual translates a physical name to a virtual name PhysicalToVirtual(pObj client.Object) types.NamespacedName }
NameTranslator is used to convert virtual to physical names and vice versa
type NamespacedTranslator ¶
type NamespacedTranslator interface { Translator // EventRecorder returns EventRecorder() record.EventRecorder // RegisterIndices registers the default indices for the syncer RegisterIndices(ctx *context.RegisterContext) error // SyncDownCreate creates the given pObj in the target namespace SyncDownCreate(ctx *context.SyncContext, vObj, pObj client.Object) (ctrl.Result, error) // SyncDownUpdate updates the given pObj (if not nil) in the target namespace SyncDownUpdate(ctx *context.SyncContext, vObj, pObj client.Object) (ctrl.Result, error) }
NamespacedTranslator provides some helper functions to ease sync down translation
func NewNamespacedTranslator ¶
func NewNamespacedTranslator(ctx *context.RegisterContext, name string, obj client.Object, excludedAnnotations ...string) NamespacedTranslator
type PhysicalNameTranslator ¶
PhysicalNameTranslator transforms a virtual cluster name to a physical name
type Translator ¶
type Translator interface { Resource() client.Object Name() string NameTranslator MetadataTranslator }
Translator is used to translate names as well as metadata between virtual and physical objects
func NewClusterTranslator ¶
func NewClusterTranslator(ctx *context.RegisterContext, name string, obj client.Object, nameTranslator PhysicalNameTranslator, excludedAnnotations ...string) Translator
func NewMirrorPhysicalTranslator ¶
func NewMirrorPhysicalTranslator(name string, obj client.Object) Translator
Click to show internal directories.
Click to hide internal directories.