cache

package
v0.7.1 Latest Latest
Warning

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

Go to latest
Published: May 15, 2026 License: Apache-2.0 Imports: 34 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ClusterAndNamespaceIndexFunc

func ClusterAndNamespaceIndexFunc(obj any) ([]string, error)

ClusterAndNamespaceIndexFunc indexes by cluster and namespace name.

func ClusterAndNamespaceIndexKey

func ClusterAndNamespaceIndexKey(clusterName logicalcluster.Name, namespace string) string

ClusterAndNamespaceIndexKey formats the index key for a cluster name and namespace.

func ClusterIndexFunc

func ClusterIndexFunc(obj any) ([]string, error)

ClusterIndexFunc indexes by cluster name.

func ClusterIndexKey

func ClusterIndexKey(clusterName logicalcluster.Name) string

ClusterIndexKey formats the index key for a cluster name.

Types

type AggregateCache added in v0.7.0

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

AggregateCache provides an aggregated view across multiple per-shard WildcardCaches.

func NewAggregateCache added in v0.7.0

func NewAggregateCache() *AggregateCache

NewAggregateCache returns an initialized AggregateCache.

func (*AggregateCache) AddCache added in v0.7.0

func (a *AggregateCache) AddCache(id string, c WildcardCache)

AddCache registers a WildcardCache under the given id.

func (*AggregateCache) List added in v0.7.0

func (a *AggregateCache) List(ctx context.Context, list client.ObjectList, opts ...client.ListOption) error

List aggregates results from all registered caches. If any error occurred while aggregating results from all caches the errors will be returned as an errors.Aggregate. Even if errors are returned the list will be filled with any results that could be aggregated.

func (*AggregateCache) RemoveCache added in v0.7.0

func (a *AggregateCache) RemoveCache(id string)

RemoveCache unregisters the WildcardCache with the given id.

type Lister added in v0.7.0

type Lister interface {
	List(ctx context.Context, list client.ObjectList, opts ...client.ListOption) error
}

Lister can list objects across all registered shard caches.

type ScopedCluster

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

ScopedCluster is a cluster that operates on a specific namespace.

func NewScopedCluster

func NewScopedCluster(cfg *rest.Config, clusterName logicalcluster.Name, wildcardCA WildcardCache, scheme *runtime.Scheme, eventRecorderGetter mcrecorder.EventRecorderGetter) (*ScopedCluster, error)

NewScopedCluster constructs a new cluster.Cluster that operates on a specific logical cluster.

func NewScopedInitializingCluster

func NewScopedInitializingCluster(cfg *rest.Config, clusterName logicalcluster.Name, wildcardCA WildcardCache, scheme *runtime.Scheme) (*ScopedCluster, error)

NewScopedInitializingCluster constructs a new cluster.Cluster that operates on a specific logical cluster for initializing workspaces. It doesn't construct client to read from wildcard cache.

func (*ScopedCluster) GetAPIReader

func (c *ScopedCluster) GetAPIReader() client.Reader

GetAPIReader returns a reader against the cluster.

func (*ScopedCluster) GetCache

func (c *ScopedCluster) GetCache() cache.Cache

GetCache returns a cache.Cache.

func (*ScopedCluster) GetClient

func (c *ScopedCluster) GetClient() client.Client

GetClient returns a client scoped to the namespace.

func (*ScopedCluster) GetConfig

func (c *ScopedCluster) GetConfig() *rest.Config

GetConfig returns the rest.Config scoped to the cluster.

func (*ScopedCluster) GetEventRecorder added in v0.5.0

func (c *ScopedCluster) GetEventRecorder(name string) events.EventRecorder

GetEventRecorder returns a EventRecorder for the given name.

func (*ScopedCluster) GetEventRecorderFor deprecated

func (c *ScopedCluster) GetEventRecorderFor(name string) record.EventRecorder

GetEventRecorderFor returns a new EventRecorder for the provided name.

Deprecated: Use GetEventRecorder.

func (*ScopedCluster) GetFieldIndexer

func (c *ScopedCluster) GetFieldIndexer() client.FieldIndexer

GetFieldIndexer returns a FieldIndexer scoped to the cluster.

func (*ScopedCluster) GetHTTPClient

func (c *ScopedCluster) GetHTTPClient() *http.Client

GetHTTPClient returns the HTTP client scoped to the cluster.

func (*ScopedCluster) GetRESTMapper

func (c *ScopedCluster) GetRESTMapper() meta.RESTMapper

GetRESTMapper returns a RESTMapper scoped to the cluster.

func (*ScopedCluster) GetScheme

func (c *ScopedCluster) GetScheme() *runtime.Scheme

GetScheme returns the scheme scoped to the cluster.

func (*ScopedCluster) Start

func (c *ScopedCluster) Start(ctx context.Context) error

Start starts the cluster.

type WildcardCache

type WildcardCache interface {
	cache.Cache
	GetSharedInformer(obj runtime.Object) (k8scache.SharedIndexInformer, schema.GroupVersionKind, apimeta.RESTScopeName, error)
}

WildcardCache is a cache that operates on a '/clusters/*' endpoint.

func NewWildcardCache

func NewWildcardCache(config *rest.Config, opts cache.Options) (WildcardCache, error)

NewWildcardCache returns a cache.Cache that handles multi-cluster watches against a /clusters/* endpoint. It wires SharedIndexInformers with additional indexes for cluster and cluster+namespace.

Jump to

Keyboard shortcuts

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