Documentation ¶
Index ¶
- Constants
- Variables
- func ApplyMetadata(fromAnnotations map[string]string, toAnnotations map[string]string, ...) (labels map[string]string, annotations map[string]string)
- func ConvertKindToResource(config *rest.Config, groupVersionKind schema.GroupVersionKind) (schema.GroupVersionResource, error)
- func CopyObjectWithName[T client.Object](obj T, name types.NamespacedName, setOwner bool) T
- func EnsureCRDFromPhysicalCluster(ctx context.Context, pConfig *rest.Config, vConfig *rest.Config, ...) (bool, bool, error)
- func GetOwnerReference(object client.Object) []metav1.OwnerReference
- func HostAnnotations(vObj, pObj client.Object, excluded ...string) map[string]string
- func HostLabel(vLabel string) string
- func HostLabelNamespace(key string) string
- func HostLabelSelector(labelSelector *metav1.LabelSelector) *metav1.LabelSelector
- func HostLabelSelectorNamespace(labelSelector *metav1.LabelSelector) *metav1.LabelSelector
- func HostLabels(vObj, pObj client.Object) map[string]string
- func HostLabelsMap(vLabels, pLabels map[string]string, vNamespace string, isMetadata bool) map[string]string
- func HostMetadata[T client.Object](vObj T, name types.NamespacedName, excludedAnnotations ...string) T
- func IsTranslatedLabel(label string) (string, bool)
- func KindExists(config *rest.Config, groupVersionKind schema.GroupVersionKind) (metav1.APIResource, error)
- func MergeLabelSelectors(elems ...*metav1.LabelSelector) *metav1.LabelSelector
- func ResetObjectMetadata(obj metav1.Object)
- func SafeConcatName(name ...string) string
- func SingleNamespaceHostName(name, namespace, suffix string) string
- func Split(s, sep string) (string, string)
- func VirtualAnnotations(pObj, vObj client.Object, excluded ...string) map[string]string
- func VirtualLabel(pLabel string) (string, bool)
- func VirtualLabelSelector(labelSelector *metav1.LabelSelector) *metav1.LabelSelector
- func VirtualLabels(pObj, vObj client.Object) map[string]string
- func VirtualLabelsMap(pLabels, vLabels map[string]string, excluded ...string) map[string]string
- func VirtualMetadata[T client.Object](pObj T, name types.NamespacedName, excludedAnnotations ...string) T
- type ApplyMapsOptions
- type Translator
Constants ¶
View Source
const (
SkipBackSyncInMultiNamespaceMode = "vcluster.loft.sh/skip-backsync"
)
Variables ¶
View Source
var ( NamespaceAnnotation = "vcluster.loft.sh/object-namespace" NameAnnotation = "vcluster.loft.sh/object-name" UIDAnnotation = "vcluster.loft.sh/object-uid" KindAnnotation = "vcluster.loft.sh/object-kind" )
View Source
var ( VClusterReleaseLabel = "release" NamespaceLabel = "vcluster.loft.sh/namespace" MarkerLabel = "vcluster.loft.sh/managed-by" ControllerLabel = "vcluster.loft.sh/controlled-by" LabelPrefix = "vcluster.loft.sh/label" NamespaceLabelPrefix = "vcluster.loft.sh/ns-label" // VClusterName is the vcluster name, usually set at start time VClusterName = "suffix" ManagedAnnotationsAnnotation = "vcluster.loft.sh/managed-annotations" ManagedLabelsAnnotation = "vcluster.loft.sh/managed-labels" )
View Source
var LabelsToTranslate = map[string]bool{ VClusterReleaseLabel: true, NamespaceLabel: true, MarkerLabel: true, ControllerLabel: true, }
View Source
var Owner client.Object
Functions ¶
func ApplyMetadata ¶ added in v0.9.0
func ConvertKindToResource ¶ added in v0.14.0
func ConvertKindToResource(config *rest.Config, groupVersionKind schema.GroupVersionKind) (schema.GroupVersionResource, error)
func CopyObjectWithName ¶ added in v0.21.0
func CopyObjectWithName[T client.Object](obj T, name types.NamespacedName, setOwner bool) T
func EnsureCRDFromPhysicalCluster ¶ added in v0.14.0
func GetOwnerReference ¶ added in v0.4.4
func GetOwnerReference(object client.Object) []metav1.OwnerReference
func HostAnnotations ¶ added in v0.21.0
func HostLabelNamespace ¶ added in v0.21.0
func HostLabelSelector ¶ added in v0.21.0
func HostLabelSelector(labelSelector *metav1.LabelSelector) *metav1.LabelSelector
func HostLabelSelectorNamespace ¶ added in v0.21.0
func HostLabelSelectorNamespace(labelSelector *metav1.LabelSelector) *metav1.LabelSelector
func HostLabelsMap ¶ added in v0.21.0
func HostMetadata ¶ added in v0.21.0
func HostMetadata[T client.Object](vObj T, name types.NamespacedName, excludedAnnotations ...string) T
func IsTranslatedLabel ¶ added in v0.21.0
func KindExists ¶ added in v0.14.0
func KindExists(config *rest.Config, groupVersionKind schema.GroupVersionKind) (metav1.APIResource, error)
KindExists returns the api resource for a given CRD. If the kind does not exist, it returns an error.
func MergeLabelSelectors ¶ added in v0.5.0
func MergeLabelSelectors(elems ...*metav1.LabelSelector) *metav1.LabelSelector
func ResetObjectMetadata ¶
ResetObjectMetadata resets the objects metadata except name, namespace and annotations
func SafeConcatName ¶
func SingleNamespaceHostName ¶ added in v0.21.0
func VirtualAnnotations ¶ added in v0.21.0
func VirtualLabel ¶ added in v0.21.0
func VirtualLabelSelector ¶ added in v0.21.0
func VirtualLabelSelector(labelSelector *metav1.LabelSelector) *metav1.LabelSelector
func VirtualLabels ¶ added in v0.21.0
func VirtualLabelsMap ¶ added in v0.21.0
func VirtualMetadata ¶ added in v0.21.0
func VirtualMetadata[T client.Object](pObj T, name types.NamespacedName, excludedAnnotations ...string) T
Types ¶
type ApplyMapsOptions ¶ added in v0.9.0
type Translator ¶ added in v0.4.4
type Translator interface { // SingleNamespaceTarget signals if we sync all objects into a single namespace SingleNamespaceTarget() bool // IsManaged checks if the host object is managed by vCluster IsManaged(ctx *synccontext.SyncContext, pObj client.Object) bool // IsTargetedNamespace checks if the provided namespace is a sync target for vcluster IsTargetedNamespace(ctx *synccontext.SyncContext, namespace string) bool // MarkerLabelCluster returns the marker label for the cluster scoped object MarkerLabelCluster() string // HostName returns the host name for a virtual cluster object HostName(ctx *synccontext.SyncContext, vName, vNamespace string) types.NamespacedName // HostNameShort returns the short host name for a virtual cluster object HostNameShort(ctx *synccontext.SyncContext, vName, vNamespace string) types.NamespacedName // HostNameCluster returns the host name for a cluster scoped // virtual cluster object HostNameCluster(vName string) string // HostNamespace returns the host namespace for a virtual cluster object HostNamespace(ctx *synccontext.SyncContext, vNamespace string) string }
var Default Translator = &singleNamespace{}
func NewMultiNamespaceTranslator ¶ added in v0.14.0
func NewMultiNamespaceTranslator(currentNamespace string) Translator
func NewSingleNamespaceTranslator ¶ added in v0.14.0
func NewSingleNamespaceTranslator(targetNamespace string) Translator
Source Files ¶
Click to show internal directories.
Click to hide internal directories.