Documentation ¶
Index ¶
- type NamespaceScopedCache
- func (nsc *NamespaceScopedCache) AddInformer(infOpts components.InformerOptions)
- func (nsc *NamespaceScopedCache) Get(key types.NamespacedName, gvk schema.GroupVersionKind) (runtime.Object, error)
- func (nsc *NamespaceScopedCache) HasInformer(infOpts components.InformerOptions) bool
- func (nsc *NamespaceScopedCache) IsStarted() bool
- func (nsc *NamespaceScopedCache) List(listOpts client.ListOptions, gvk schema.GroupVersionKind) ([]runtime.Object, error)
- func (nsc *NamespaceScopedCache) RemoveInformer(infOpts components.InformerOptions, force bool)
- func (nsc *NamespaceScopedCache) Start()
- func (nsc *NamespaceScopedCache) Synced() bool
- func (nsc *NamespaceScopedCache) Terminate()
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type NamespaceScopedCache ¶
type NamespaceScopedCache struct { Namespaces map[string]components.GvkToInformers // contains filtered or unexported fields }
NamespaceScopedCache is a dynamic cache with a focus on only tracking informers with watches at a namespace level
func NewNamespaceScopedCache ¶
func NewNamespaceScopedCache() *NamespaceScopedCache
NewNamespaceScopedCache will return a new NamespaceScopedCache
func (*NamespaceScopedCache) AddInformer ¶
func (nsc *NamespaceScopedCache) AddInformer(infOpts components.InformerOptions)
AddInformer will add a new informer to the NamespaceScopedCache based on the informer options provided. The general flow of this function is: - Create a new ScopeInformer - Add the ScopeInformer to the cache based on the provided options - Set the WatchErrorHandler on the ScopeInformer to forcefully remove the ScopeInformer from the cache - If the NamespaceScopedCache has been started, start the ScopeInformer
func (*NamespaceScopedCache) Get ¶
func (nsc *NamespaceScopedCache) Get(key types.NamespacedName, gvk schema.GroupVersionKind) (runtime.Object, error)
Get will attempt to get a Kubernetes resource from the cache for the provided key and GVK. The general flow of this function is: - If an informer doesn't exist that can facilitate finding a resource based on the provided key & GVK an InformerNotFoundErr will be returned - Every Informer for a Namespace-GVK pair will be queried. -- If the requested resource is found it will be returned -- If the requested resource is not found a NotFound error will be returned
func (*NamespaceScopedCache) HasInformer ¶
func (nsc *NamespaceScopedCache) HasInformer(infOpts components.InformerOptions) bool
GvkHasInformer returns whether or not an informer exists in the cache for the provided components.InformerOptions
func (*NamespaceScopedCache) IsStarted ¶
func (nsc *NamespaceScopedCache) IsStarted() bool
IsStarted returns whether or not the cache has been started
func (*NamespaceScopedCache) List ¶
func (nsc *NamespaceScopedCache) List(listOpts client.ListOptions, gvk schema.GroupVersionKind) ([]runtime.Object, error)
List will attempt to get a list of Kubernetes resource from the cache for the provided ListOptions and GVK. The general flow of this function is: - If the provided ListOptions.Namespace != "" -- If an informer doesn't exist that can facilitate finding a list of resources based on the provided namespace & GVK an InformerNotFoundErr will be returned -- Every Informer for a Namespace-GVK pair will be queried and the results will be aggregated into a single list. Any errors encountered will be returned immediately. - If the provided ListOptions.Namespace == "" -- Every Namespace that has informers for the provided gvk will be queried and the results will be aggregated into a single list. Any errors encountered will be returned immediately. - The results will be deduplicated and returned.
func (*NamespaceScopedCache) RemoveInformer ¶
func (nsc *NamespaceScopedCache) RemoveInformer(infOpts components.InformerOptions, force bool)
RemoveInformer will remove an informer from the NamespaceScopedCache based on the informer options provided. The general flow of this function is: - Get the ScopeInformer based on the provided options - Remove the provided Dependent from the ScopeInformer - If there are no more dependents for the ScopeInformer OR the removal is forced delete the informer from the cache and terminate it. - If there are no more informers for the given Namespace-GVK pair, remove it from the cache - If there are no more informers for the given Namespace, remove it from the cache
func (*NamespaceScopedCache) Start ¶
func (nsc *NamespaceScopedCache) Start()
Start will start the cache and all it's informers
func (*NamespaceScopedCache) Synced ¶
func (nsc *NamespaceScopedCache) Synced() bool
Synced returns whether or not the cache has synced
func (*NamespaceScopedCache) Terminate ¶
func (nsc *NamespaceScopedCache) Terminate()
Terminate will shutdown all informers in the cache and then proceed to shutdown the cache.