mailboxwatch

package
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: May 17, 2023 License: Apache-2.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewSharedInformer

func NewSharedInformer[Scoped ScopedListerWatcher[ListType], ListType runtime.Object](
	ctx context.Context,
	listGVK machschema.GroupVersionKind,
	mailboxWorkspacePreInformer tenancyv1a1informers.WorkspaceInformer,
	listerWatcher ClusterListerWatcher[Scoped, ListType],
	exampleObject runtime.Object,
	defaultEventHandlerResyncPeriod time.Duration,
	indexers upstreamcache.Indexers,
) kcpcache.ScopeableSharedIndexInformer

NewSharedInformer constructs a shared index informer on objects of a given kind in mailbox workspaces. It follows the usual pattern for a constructor of informers except for additional parameters at the start: - a context.Context, because, really; - the GroupVersionKind of a _list_; - an informer on mailbox workspaces, used to keep appraised of the mailbox workspaces. The ListerWatcher should be among your generated client code, see the comments on ScopedListerWatcher and ClusterListerWatcher. Like any informer, the one returned here needs to be `Run`.

func NewSharedInformerForEdgeConfig

func NewSharedInformerForEdgeConfig[Scoped ScopedListerWatcher[ListType], ListType runtime.Object](
	ctx context.Context,
	listGVK machschema.GroupVersionKind,
	edgeServiceProviderWorkspaceClientConfig *restclient.Config,
	listerWatcher ClusterListerWatcher[Scoped, ListType],
	exampleObject runtime.Object,
	defaultEventHandlerResyncPeriod time.Duration,
	indexers upstreamcache.Indexers,
) (tenancyv1a1informers.WorkspaceInformer, kcpcache.ScopeableSharedIndexInformer, error)

NewSharedInformerForEdgeConfig is like NewSharedInformer but takes a REST Config for the edge service provider workspace and constructs the pre-informer for the mailbox workspaces. That pre-informer is then used to call NewSharedInformer and is also returned, so that the caller can wait on HasSynced of the mailbox workspace informer.

Types

type ClusterListerWatcher

type ClusterListerWatcher[Scoped ScopedListerWatcher[ListType], ListType runtime.Object] interface {
	Cluster(logicalcluster.Path) Scoped
}

ClusterListerWatcher is something that can map a cluster to a ScopedListerWatcher for that cluster. These are among the generated code for a cluster-scoped resource. For an example, see https://github.com/kcp-dev/kcp/blob/v0.11.0/pkg/client/clientset/versioned/cluster/typed/scheduling/v1alpha1/placement.go#L47-L48 ; `PlacementClusterInterface` is a subtype of `ClusterListerWatcher[PlacementInterface, *schedulingv1alpha1.PlacementList]`.

func FixNamespace

func FixNamespace[NSer Namespacer[Scoped, ListType],
	Scoped ScopedListerWatcher[ListType],
	ListType runtime.Object,
](ncl NamespacedClusterListerWatcher[NSer, Scoped, ListType], namespace string,
) ClusterListerWatcher[Scoped, ListType]

FixNamespace makes a ClusterListerWatcher out of a NamespacedClusterListerWatcher and a namespace value (possibly metav1.NamespaceAll).

type NamespacedClusterListerWatcher

type NamespacedClusterListerWatcher[NSer Namespacer[Scoped, ListType],
	Scoped ScopedListerWatcher[ListType],
	ListType runtime.Object,
] interface {
	Cluster(logicalcluster.Path) NSer
}

NamespacedClusterListerWatcher is something that can map a cluster to a Namespacer for that cluster. These are among the generated code for a namespace-scoped resource. For an example, see the generated code for ReplicaSet at https://github.com/kcp-dev/client-go/blob/aeff170a288b8e135b5db640d08e6e43da0f46ec/kubernetes/typed/apps/v1/replicaset.go#L45 ; ReplicaSetClusterInterface is a subtype of NamespacedClusterListerWatcher[ReplicaSetNamespacer, appsv1client.ReplicaSetInterface, *ReplicaSetList]

type Namespacer

type Namespacer[Scoped ScopedListerWatcher[ListType], ListType runtime.Object] interface {
	Namespace(string) Scoped
}

Namespacer is something that takes a namespace (possibly metav1.NamespaceAll) and returns a ScopedListerWatcher. For an example, see the generated code for ReplicaSet at https://github.com/kcp-dev/client-go/blob/aeff170a288b8e135b5db640d08e6e43da0f46ec/kubernetes/typed/apps/v1/replicaset.go#L75 ; ReplicaSetsNamespacer is a subtype of Namespacer[appsv1client.ReplicaSetInterface, *ReplicaSetList] .

type ScopedListerWatcher

type ScopedListerWatcher[ListType runtime.Object] interface {
	List(ctx context.Context, opts metav1.ListOptions) (ListType, error)
	Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error)
}

ScopedListerWatcher is a ListWatcher that takes a Context and returns a specific type of list object. It is specific to one cluster. For an example, see https://github.com/kcp-dev/kcp/blob/v0.11.0/pkg/client/clientset/versioned/typed/scheduling/v1alpha1/placement.go#L48-L49 ; `PlacementInterface` is a subtype of `ScopedListerWatcher[*schedulingv1alpha1.PlacementList]`.

Jump to

Keyboard shortcuts

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