Documentation ¶
Index ¶
- func BuildMultiClusterResourceVersion(clusterResourceMap map[string]string) string
- func RecoverClusterResourceVersion(obj runtime.Object, cluster string) bool
- func RemoveCacheSourceAnnotation(obj runtime.Object) bool
- type MultiClusterCache
- func (c *MultiClusterCache) Get(ctx context.Context, gvr schema.GroupVersionResource, name string, ...) (runtime.Object, error)
- func (c *MultiClusterCache) GetResourceFromCache(ctx context.Context, gvr schema.GroupVersionResource, namespace, name string) (runtime.Object, string, error)
- func (c *MultiClusterCache) HasResource(resource schema.GroupVersionResource) bool
- func (c *MultiClusterCache) List(ctx context.Context, gvr schema.GroupVersionResource, ...) (runtime.Object, error)
- func (c *MultiClusterCache) Stop()
- func (c *MultiClusterCache) UpdateCache(resourcesByCluster map[string]map[schema.GroupVersionResource]*MultiNamespace) error
- func (c *MultiClusterCache) Watch(ctx context.Context, gvr schema.GroupVersionResource, ...) (watch.Interface, error)
- type MultiNamespace
- type Store
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BuildMultiClusterResourceVersion ¶ added in v1.3.1
BuildMultiClusterResourceVersion build multi cluster resource version.
func RecoverClusterResourceVersion ¶ added in v1.3.1
RecoverClusterResourceVersion convert global resource version to single cluster resource version. If obj is updated, return true.
func RemoveCacheSourceAnnotation ¶ added in v1.3.1
RemoveCacheSourceAnnotation delete CacheSourceAnnotationKey annotation in object. If obj is updated, return true.
Types ¶
type MultiClusterCache ¶
type MultiClusterCache struct {
// contains filtered or unexported fields
}
MultiClusterCache caches resource from multi member clusters
func NewMultiClusterCache ¶
func NewMultiClusterCache(newClientFunc func(string) (dynamic.Interface, error), restMapper meta.RESTMapper) *MultiClusterCache
NewMultiClusterCache return a cache for resources from member clusters
func (*MultiClusterCache) Get ¶
func (c *MultiClusterCache) Get(ctx context.Context, gvr schema.GroupVersionResource, name string, options *metav1.GetOptions) (runtime.Object, error)
Get returns the target object
func (*MultiClusterCache) GetResourceFromCache ¶
func (c *MultiClusterCache) GetResourceFromCache(ctx context.Context, gvr schema.GroupVersionResource, namespace, name string) (runtime.Object, string, error)
GetResourceFromCache returns which cluster the resource belong to.
func (*MultiClusterCache) HasResource ¶
func (c *MultiClusterCache) HasResource(resource schema.GroupVersionResource) bool
HasResource return whether resource is cached.
func (*MultiClusterCache) List ¶
func (c *MultiClusterCache) List(ctx context.Context, gvr schema.GroupVersionResource, o *metainternalversion.ListOptions) (runtime.Object, error)
List returns the object list nolint:gocyclo
func (*MultiClusterCache) Stop ¶
func (c *MultiClusterCache) Stop()
Stop stops the cache for multi cluster.
func (*MultiClusterCache) UpdateCache ¶
func (c *MultiClusterCache) UpdateCache(resourcesByCluster map[string]map[schema.GroupVersionResource]*MultiNamespace) error
UpdateCache update cache for multi clusters
func (*MultiClusterCache) Watch ¶
func (c *MultiClusterCache) Watch(ctx context.Context, gvr schema.GroupVersionResource, options *metainternalversion.ListOptions) (watch.Interface, error)
Watch watches the resource
type MultiNamespace ¶ added in v1.6.0
type MultiNamespace struct {
// contains filtered or unexported fields
}
MultiNamespace contains multiple namespaces.
func NewMultiNamespace ¶ added in v1.6.0
func NewMultiNamespace() *MultiNamespace
NewMultiNamespace return a new empty MultiNamespace.
func (*MultiNamespace) Contains ¶ added in v1.6.0
func (n *MultiNamespace) Contains(ns string) bool
Contains returns if ns is covered by MultiNamespace. NamespaceAll covers all.
func (*MultiNamespace) Equal ¶ added in v1.6.0
func (n *MultiNamespace) Equal(another *MultiNamespace) bool
Equal tell whether two MultiNamespace has the same namespaces.
func (*MultiNamespace) Single ¶ added in v1.6.0
func (n *MultiNamespace) Single() (string, bool)
Single returns ns name and true when only one namespace in MultiNamespace. NamespaceAll returns false.
type Store ¶ added in v1.4.0
type Store interface { UpdateCache(resourcesByCluster map[string]map[schema.GroupVersionResource]*MultiNamespace) error HasResource(resource schema.GroupVersionResource) bool GetResourceFromCache(ctx context.Context, gvr schema.GroupVersionResource, namespace, name string) (runtime.Object, string, error) Stop() Get(ctx context.Context, gvr schema.GroupVersionResource, name string, options *metav1.GetOptions) (runtime.Object, error) List(ctx context.Context, gvr schema.GroupVersionResource, options *metainternalversion.ListOptions) (runtime.Object, error) Watch(ctx context.Context, gvr schema.GroupVersionResource, options *metainternalversion.ListOptions) (watch.Interface, error) }
Store is the cache for resources from multiple member clusters