Documentation ¶
Index ¶
- Constants
- Variables
- func ContainsGVR(gvrs []schema.GroupVersionResource, gvr schema.GroupVersionResource) bool
- func DeprecatedGetAssignedSyncTarget(labels map[string]string) stringdeprecated
- func EnsureUpstreamFinalizerRemoved(ctx context.Context, gvr schema.GroupVersionResource, ...) error
- func GetDNSID(clusterName logicalcluster.Name, syncTargetUID types.UID, ...) string
- func GetTenantID(l NamespaceLocator) (string, error)
- func GetUpstreamResourceName(downstreamResourceGVR schema.GroupVersionResource, ...) string
- func PhysicalClusterNamespaceName(l NamespaceLocator) (string, error)
- type Cleaner
- type NamespaceLocator
- func LocatorFromAnnotations(annotations map[string]string) (*NamespaceLocator, bool, error)
- func NewNamespaceLocator(workspace, syncTargetClusterName logicalcluster.Name, syncTargetUID types.UID, ...) NamespaceLocator
- func NewNamespaceLocatorV060(workspace, syncTargetClusterName logicalcluster.Name, syncTargetUID types.UID, ...) NamespaceLocator
- type SyncTargetLocator
Constants ¶
const ( NamespaceLocatorAnnotation = "kcp.io/namespace-locator" TenantIDLabel = "kcp.io/tenant-id" )
const ( // SyncerFinalizerNamePrefix is the finalizer put onto resources by the syncer to claim ownership, // *before* a downstream object is created. It is only removed when the downstream object is deleted. SyncerFinalizerNamePrefix = "workload.kcp.io/syncer-" )
Variables ¶
var SyncableClusterScopedResources = sets.New[string](schema.GroupVersionResource{Group: "", Version: "v1", Resource: "persistentvolumes"}.String())
SyncableClusterScopedResources holds a set of cluster-wide GVR that are allowed to be synced.
Functions ¶
func ContainsGVR ¶
func ContainsGVR(gvrs []schema.GroupVersionResource, gvr schema.GroupVersionResource) bool
func DeprecatedGetAssignedSyncTarget
deprecated
func GetDNSID ¶
func GetDNSID(clusterName logicalcluster.Name, syncTargetUID types.UID, syncTargetName string) string
GetDNSID returns a unique ID for DNS object derived from the sync target name, its UID and workspace. It's a valid DNS segment and can be used as namespace or object names.
func GetTenantID ¶
func GetTenantID(l NamespaceLocator) (string, error)
GetTenantID encodes the KCP tenant to which the namespace designated by the given NamespaceLocator belongs. It is based on the NamespaceLocator, but with an empty namespace value. The value will be the same for all downstream namespaces originating from the same KCP workspace / SyncTarget. The encoding is repeatable.
func GetUpstreamResourceName ¶
func GetUpstreamResourceName(downstreamResourceGVR schema.GroupVersionResource, downstreamResourceName string) string
GetUpstreamResourceName returns the name with which the resource is known upstream.
func PhysicalClusterNamespaceName ¶
func PhysicalClusterNamespaceName(l NamespaceLocator) (string, error)
PhysicalClusterNamespaceName encodes the NamespaceLocator into a new namespace name for use on a physical cluster. The encoding is repeatable.
Types ¶
type Cleaner ¶
type Cleaner interface { // PlanCleaning adds the key to the list of keys to be cleaned up. // If the resource was already planned for cleaning the previous timestamp is kept. PlanCleaning(key string) // CancelCleaning removes the key from the list of keys to be cleaned up. // If it wasn't planned for deletion, it does nothing. CancelCleaning(key string) }
Cleaner is an interface for cleaning up resources.
type NamespaceLocator ¶
type NamespaceLocator struct { SyncTarget SyncTargetLocator `json:"syncTarget"` ClusterName logicalcluster.Name `json:"cluster,omitempty"` Namespace string `json:"namespace"` }
NamespaceLocator stores a logical cluster and namespace and is used as the source for the mapped namespace name in a physical cluster.
func LocatorFromAnnotations ¶
func LocatorFromAnnotations(annotations map[string]string) (*NamespaceLocator, bool, error)
func NewNamespaceLocator ¶
func NewNamespaceLocator(workspace, syncTargetClusterName logicalcluster.Name, syncTargetUID types.UID, syncTargetName, upstreamNamespace string) NamespaceLocator
func NewNamespaceLocatorV060 ¶
func NewNamespaceLocatorV060(workspace, syncTargetClusterName logicalcluster.Name, syncTargetUID types.UID, syncTargetName, upstreamNamespace string) NamespaceLocator