translate

package
v0.5.3 Latest Latest
Warning

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

Go to latest
Published: Jan 19, 2022 License: Apache-2.0 Imports: 9 Imported by: 7

Documentation

Index

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"
)
View Source
var (
	NamespaceLabel = "vcluster.loft.sh/namespace"
	MarkerLabel    = "vcluster.loft.sh/managed-by"
	Suffix         = "suffix"
)

Functions

func ConvertLabelKey added in v0.3.0

func ConvertLabelKey(key string) string

func ConvertLabelKeyWithPrefix added in v0.5.0

func ConvertLabelKeyWithPrefix(prefix, key string) string

func DefaultImageRegistry added in v0.5.0

func DefaultImageRegistry() string

func DefaultPhysicalName added in v0.4.5

func DefaultPhysicalName(vName string, vObj client.Object) string

func GetOwnerReference added in v0.4.4

func GetOwnerReference() []metav1.OwnerReference

func IsManaged

func IsManaged(obj runtime.Object) bool

func IsManagedCluster added in v0.4.0

func IsManagedCluster(physicalNamespace string, obj runtime.Object) bool

func MergeLabelSelectors added in v0.5.0

func MergeLabelSelectors(elems ...*metav1.LabelSelector) *metav1.LabelSelector

func ObjectPhysicalName

func ObjectPhysicalName(obj runtime.Object) string

ObjectPhysicalName returns the translated physical name of this object

func PhysicalName

func PhysicalName(name, namespace string) string

PhysicalName returns the physical name of the name / namespace resource

func PhysicalNameClusterScoped added in v0.4.0

func PhysicalNameClusterScoped(name, physicalNamespace string) string

PhysicalNameClusterScoped returns the physical name of a cluster scoped object in the host cluster

func ResetObjectMetadata

func ResetObjectMetadata(obj metav1.Object)

ResetObjectMetadata resets the objects metadata except name, namespace and annotations

func SafeConcatGenerateName added in v0.3.0

func SafeConcatGenerateName(name ...string) string

func SafeConcatName

func SafeConcatName(name ...string) string

func Split

func Split(s, sep string) (string, string)

func TranslateLabelSelector added in v0.3.0

func TranslateLabelSelector(labelSelector *metav1.LabelSelector) *metav1.LabelSelector

func TranslateLabelSelectorCluster added in v0.4.0

func TranslateLabelSelectorCluster(physicalNamespace string, labelSelector *metav1.LabelSelector) *metav1.LabelSelector

func TranslateLabelSelectorWithPrefix added in v0.5.0

func TranslateLabelSelectorWithPrefix(labelPrefix string, labelSelector *metav1.LabelSelector) *metav1.LabelSelector

func UniqueSlice

func UniqueSlice(stringSlice []string) []string

Types

type PhysicalNameTranslator added in v0.4.0

type PhysicalNameTranslator func(vName string, vObj client.Object) string

type Translator added in v0.4.4

type Translator interface {
	Translate(vObj client.Object) (runtime.Object, error)
	TranslateLabels(vObj client.Object) map[string]string
	TranslateAnnotations(vObj client.Object, pObj client.Object) map[string]string
}

func NewDefaultClusterTranslator added in v0.4.4

func NewDefaultClusterTranslator(physicalNamespace string, nameTranslator PhysicalNameTranslator, excludedAnnotations ...string) Translator

func NewDefaultTranslator added in v0.4.4

func NewDefaultTranslator(physicalNamespace string, excludedAnnotations ...string) Translator

Jump to

Keyboard shortcuts

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