resourcecache

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Jan 12, 2021 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type GVRCache

type GVRCache struct {
	// GVR Group Version Resource of a resource
	GVR schema.GroupVersionResource
	// Namespaced - identifies if a resource is namespaced or not
	Namespaced bool
	// contains filtered or unexported fields
}

GVRCache ...

func (*GVRCache) GetLister

func (gvrc *GVRCache) GetLister() cache.GenericLister

GetLister - get access to Lister() instance of a resource in GVRCache

func (*GVRCache) GetNamespacedLister

func (gvrc *GVRCache) GetNamespacedLister(namespace string) cache.GenericNamespaceLister

GetNamespacedLister - get access to namespaced Lister() instance of a resource in GVRCache

func (*GVRCache) IsNamespaced

func (gvrc *GVRCache) IsNamespaced() bool

IsNamespaced ...

func (*GVRCache) StopInformer

func (gvrc *GVRCache) StopInformer()

StopInformer ...

type GVRCacheIface

type GVRCacheIface interface {
	StopInformer()
	IsNamespaced() bool
	GetLister() cache.GenericLister
	GetNamespacedLister(namespace string) cache.GenericNamespaceLister
}

GVRCacheIface - allows operation on a single resource

func NewGVRCache

func NewGVRCache(gvr schema.GroupVersionResource, namespaced bool, stopCh chan struct{}, genericInformer informers.GenericInformer) GVRCacheIface

NewGVRCache ...

type ResourceCache

type ResourceCache struct {

	// GVRCacheData - stores the informers and lister object for a resource.
	// it uses resource name as key (For ex :-  namespaces for Namespace, pods for Pod, clusterpolicies for ClusterPolicy etc)
	// GVRCache stores GVR (Group Version Resource) for the resource, Informer() instance and Lister() instance for that resource.
	GVRCacheData map[string]*GVRCache
	// contains filtered or unexported fields
}

ResourceCache ...

func (*ResourceCache) CreateResourceInformer

func (resc *ResourceCache) CreateResourceInformer(log logr.Logger, resource string) (bool, error)

CreateResourceInformer - check the availability of the given resource in ResourceCache. if available then create an informer for that GVR and store that GenericInformer instance in the cache and start watching for that resource

func (*ResourceCache) GetGVRCache

func (resc *ResourceCache) GetGVRCache(resource string) *GVRCache

GetGVRCache - get the GVRCache for a given resource if available

func (*ResourceCache) RunAllInformers

func (resc *ResourceCache) RunAllInformers(log logr.Logger)

RunAllInformers - run the informers for the GVR of all the resources available in GVRCacheData

func (*ResourceCache) StopResourceInformer

func (resc *ResourceCache) StopResourceInformer(log logr.Logger, resource string) bool

StopResourceInformer - delete the given resource information from ResourceCache and stop watching for the given resource

type ResourceCacheIface

type ResourceCacheIface interface {
	RunAllInformers(log logr.Logger)
	CreateResourceInformer(log logr.Logger, resource string) (bool, error)
	StopResourceInformer(log logr.Logger, resource string) bool
	GetGVRCache(resource string) *GVRCache
}

ResourceCacheIface - allows the creation, deletion and saving the resource informers as a cache

func NewResourceCache

func NewResourceCache(log logr.Logger, config *rest.Config, dclient *dclient.Client, match []string, exclude []string) (ResourceCacheIface, error)

NewResourceCache - initializes the ResourceCache where it initially stores the GVR and Namespaced condition for the allowed resources in GVRCacheData

Jump to

Keyboard shortcuts

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