cache

package
v0.0.0-...-f4a9b6a Latest Latest
Warning

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

Go to latest
Published: Aug 24, 2022 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsAPINamespaced

func IsAPINamespaced(obj runtime.Object, scheme *runtime.Scheme, restmapper apimeta.RESTMapper) (bool, error)

IsAPINamespaced returns true if the object is namespace scoped. For unstructured objects the gvk is found from the object itself.

func IsAPINamespacedWithGVK

func IsAPINamespacedWithGVK(gk schema.GroupVersionKind, scheme *runtime.Scheme, restmapper apimeta.RESTMapper) (bool, error)

IsAPINamespacedWithGVK returns true if the object having the provided GVK is namespace scoped.

func ScopedCacheBuilder

func ScopedCacheBuilder() cache.NewCacheFunc

Types

type NamespacedResourceCache

type NamespacedResourceCache map[string]ResourceCache

type NamespacedResourceInformer

type NamespacedResourceInformer map[string]ResourceInformer

type ResourceCache

type ResourceCache map[types.UID]cache.Cache

use the resource UID

type ResourceInformer

type ResourceInformer map[types.UID]cache.Informer

type ScopedCache

type ScopedCache struct {
	RESTMapper apimeta.RESTMapper
	Scheme     *runtime.Scheme
	// contains filtered or unexported fields
}

func (*ScopedCache) AddResourceCache

func (sc *ScopedCache) AddResourceCache(resource client.Object, cache cache.Cache) error

AddResourceCache will add a cache for a particular resource

func (*ScopedCache) Get

func (sc *ScopedCache) Get(ctx context.Context, key client.ObjectKey, obj client.Object) error

func (*ScopedCache) GetInformer

func (sc *ScopedCache) GetInformer(ctx context.Context, obj client.Object) (cache.Informer, error)

Update to this: It turns out that if the informer is not able to connect, it blocks. This makes it so that any other CRs don't get reconciled. We will have to omit getting particular informers if the ServiceAccount does not have permissions

func (*ScopedCache) GetInformerForKind

func (sc *ScopedCache) GetInformerForKind(ctx context.Context, gvk schema.GroupVersionKind) (cache.Informer, error)

func (*ScopedCache) GetResourceCache

func (sc *ScopedCache) GetResourceCache() NamespacedResourceCache

GetResourceCache will return the mapping of Namespace -> Resource -> Cache

func (*ScopedCache) IndexField

func (sc *ScopedCache) IndexField(ctx context.Context, obj client.Object, field string, extractValue client.IndexerFunc) error

func (*ScopedCache) List

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

func (*ScopedCache) ListForNamespace

func (sc *ScopedCache) ListForNamespace(ctx context.Context, list client.ObjectList, namespace string, opts ...client.ListOption) error

func (*ScopedCache) RemoveResourceCache

func (sc *ScopedCache) RemoveResourceCache(resource client.Object) error

RemoveResourceCache will remove a cache for a particular resource

func (*ScopedCache) Start

func (sc *ScopedCache) Start(ctx context.Context) error

func (*ScopedCache) StartResourceCache

func (sc *ScopedCache) StartResourceCache(ctx context.Context, resource client.Object)

StartResourceCache used to start a ResourceCache after it has been added

func (*ScopedCache) WaitForCacheSync

func (sc *ScopedCache) WaitForCacheSync(ctx context.Context) bool

type ScopedInformer

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

func (*ScopedInformer) AddEventHandler

func (i *ScopedInformer) AddEventHandler(handler toolscache.ResourceEventHandler)

AddEventHandler adds the handler to each informer.

func (*ScopedInformer) AddEventHandlerWithResyncPeriod

func (i *ScopedInformer) AddEventHandlerWithResyncPeriod(handler toolscache.ResourceEventHandler, resyncPeriod time.Duration)

AddEventHandlerWithResyncPeriod adds the handler with a resync period to each informer.

func (*ScopedInformer) AddIndexers

func (i *ScopedInformer) AddIndexers(indexers toolscache.Indexers) error

AddIndexers adds the indexer for each informer.

func (*ScopedInformer) HasSynced

func (i *ScopedInformer) HasSynced() bool

HasSynced checks if each informer has synced.

func (*ScopedInformer) SetWatchErrorHandler

func (i *ScopedInformer) SetWatchErrorHandler(handler toolscache.WatchErrorHandler) error

SetWatchErrorHandler will attempt to set the watch error handler on the informer

Jump to

Keyboard shortcuts

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