replication

package
v0.33.1 Latest Latest
Warning

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

Go to latest
Published: Sep 22, 2026 License: Apache-2.0 Imports: 29 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AnnotationKeyOriginalResourceVersion = "cache.kcp.io/original-resource-version"
	AnnotationKeyOriginalResourceUID     = "cache.kcp.io/original-resource-UID"
)
View Source
const (
	// ControllerName hold this controller name.
	ControllerName = "kcp-cluster-cached-resource-replication-controller"
)

Variables

This section is empty.

Functions

func InstallIndexers

func InstallIndexers(replicated *ReplicatedGVR)

InstallIndexers adds the additional indexers that this controller requires to the informers.

Types

type Controller

type Controller struct {
	// contains filtered or unexported fields
}

func NewController

func NewController(
	shardName string,
	localDynamicClusterClient kcpdynamic.ClusterInterface,
	globalDynamicClusterClient kcpdynamic.ClusterInterface,
	kcpCacheClient kcpclientset.ClusterInterface,
	cacheApiExtensionsClusterClient kcpapiextensionsclientset.ClusterInterface,
	cluster logicalcluster.Name,
	gvr schema.GroupVersionResource,
	replicated *ReplicatedGVR,
	requeueSelf func(),
	selection Selection,
) (*Controller, error)

NewController returns a new replication controller.

func (*Controller) SetDeleted

func (c *Controller) SetDeleted(ctx context.Context)

func (*Controller) SetSelection

func (c *Controller) SetSelection(selection Selection)

func (*Controller) Start

func (c *Controller) Start(ctx context.Context, workers int)

Start starts the controller, which stops when ctx.Done() is closed.

func (*Controller) Started

func (c *Controller) Started() bool

type ReplicatedGVR

type ReplicatedGVR struct {
	Kind          string
	Identity      string
	Filter        func(u *unstructured.Unstructured) bool
	Global, Local cache.SharedIndexInformer
}

type Selection

type Selection struct {
	Labels labels.Selector
	Names  sets.Set[string]
}

Selection is what a ClusterCachedResource says it publishes: everything of its kind, or some subset picked out by labels, by name, or by both.

func SelectionFor

func SelectionFor(clusterCachedResource *cachev1alpha1.ClusterCachedResource) Selection

SelectionFor reads the selection off a ClusterCachedResource. A resource that sets neither publishes its whole kind.

func (Selection) Filter

Filter drops the objects a selection does not publish.

func (Selection) ListOptions

func (s Selection) ListOptions() metav1.ListOptions

ListOptions returns the part of the selection the API server can apply for us. Names are left out on purpose -- a field selector only compares one value and a selection may name several -- so a caller that lists still has to run the results through Matches.

func (Selection) Matches

func (s Selection) Matches(obj metav1.Object) bool

Matches reports whether an object is one of the ones being published. Both halves apply: an object has to satisfy every part of the selection that is set.

Jump to

Keyboard shortcuts

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