Documentation ¶
Index ¶
- func NewLogicalClusterIndex(syncerDDSIF, upsyncerDDSIF *informer.DiscoveringDynamicSharedInformerFactory) *logicalClusterIndex
- func NewShardManager(...) *shardManager
- func NewSyncTargetController(syncerLogger logr.Logger, ...) (*controller, error)
- func NewSyncTargetGVRSource(syncTargetInformer workloadv1alpha1informers.SyncTargetInformer, ...) *syncTargetGVRSource
- type CommitFunc
- type GetShardAccessFunc
- type Patcher
- type Resource
- type ShardAccess
- type SyncTarget
- type SyncTargetSpec
- type SyncTargetStatus
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewLogicalClusterIndex ¶
func NewLogicalClusterIndex(syncerDDSIF, upsyncerDDSIF *informer.DiscoveringDynamicSharedInformerFactory) *logicalClusterIndex
NewLogicalClusterIndex creates an index that contains all the keys of the synced and upsynced resources, indexed by logical cluster name. This index is filled by the syncer and upsyncer ddsifs, and is used to check if the related shard contains a given logicalCluster.
func NewShardManager ¶
func NewShardManager( newShardControllers func(ctx context.Context, shardURLs workloadv1alpha1.VirtualWorkspace) (acces *ShardAccess, start func() error, err error)) *shardManager
NewShardManager returns a [ShardManager] that can manage the addition or removal of shard-specific upstream virtual workspace URLs, based on a SyncTarget resource passed to the updateShards() method.
When a shard is found (identified by the couple of virtual workspace URLs - for both syncer and upsyncer), then the newShardControllers() method is called, the resulting ShardAccess is stored, and the resulting start() function is called in a goroutine.
When a shard is removed, the context initially passed to the startShardControllers() method is cancelled.
The ShardAccessForCluster() method will be used by some downstream controllers in order to be able to get / list upstream resources in the right shard.
func NewSyncTargetController ¶
func NewSyncTargetController( syncerLogger logr.Logger, syncTargetClient workloadv1alpha1client.SyncTargetInterface, syncTargetInformer workloadv1alpha1informers.SyncTargetInformer, syncTargetName string, syncTargetClusterName logicalcluster.Name, syncTargetUID types.UID, gvrSource *syncTargetGVRSource, shardManager *shardManager, startShardTunneler func(ctx context.Context, shardURL workloadv1alpha1.TunnelWorkspace), ) (*controller, error)
NewSyncTargetController returns a controller that watches the workloadv1alpha1.SyncTarget associated to this syncer. It then calls the update methods on the shardManager and gvrSource that were passed in arguments, to update available shards and GVRs according to the content of the SyncTarget status.
func NewSyncTargetGVRSource ¶
func NewSyncTargetGVRSource( syncTargetInformer workloadv1alpha1informers.SyncTargetInformer, downstreamKubeClient *kubernetes.Clientset, ) *syncTargetGVRSource
NewSyncTargetGVRSource returns an informer.GVRSource that can update its list of GVRs based on a SyncTarget resource passed to the updateGVRs() method.
It will be used to feed the various informer.DiscoveringDynamicSharedInformerFactory instances for downstream and upstream.
Types ¶
type GetShardAccessFunc ¶
type GetShardAccessFunc func(clusterName logicalcluster.Name) (ShardAccess, bool, error)
GetShardAccessFunc is the type of a function that provide a ShardAccess from a logical cluster name.
type Patcher ¶
type Patcher = workloadv1alpha1client.SyncTargetInterface
type Resource ¶
type Resource = committer.Resource[*SyncTargetSpec, *SyncTargetStatus]
type ShardAccess ¶
type ShardAccess struct { SyncerClient kcpdynamic.ClusterInterface SyncerDDSIF *informer.DiscoveringDynamicSharedInformerFactory UpsyncerClient kcpdynamic.ClusterInterface UpsyncerDDSIF *informer.DiscoveringDynamicSharedInformerFactory // LogicalClusterIndex contains all the keys of the synced and upsynced resources // indexed by logical cluster name. LogicalClusterIndex *logicalClusterIndex }
ShardAccess contains clustered dynamic clients, as well as cluster-aware informer factories for both the Syncer and Upsyncer virtual workspaces associated to a Shard.
type SyncTarget ¶
type SyncTarget = workloadv1alpha1.SyncTarget
type SyncTargetSpec ¶
type SyncTargetSpec = workloadv1alpha1.SyncTargetSpec
type SyncTargetStatus ¶
type SyncTargetStatus = workloadv1alpha1.SyncTargetStatus