informer

package
v0.61.1 Latest Latest
Warning

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

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

Documentation

Overview

Package informer provides a shared informer manager for Kubernetes resources.

Index

Constants

View Source
const VANodeNameIndexer = "spec.nodeName"

VANodeNameIndexer is the indexer key for looking up VolumeAttachments by node name.

Variables

This section is empty.

Functions

This section is empty.

Types

type Manager

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

Manager manages the global SharedInformerFactory and provides access to specific informers and listers.

func NewManager

func NewManager(
	log logrus.FieldLogger,
	clientset kubernetes.Interface,
	resyncPeriod time.Duration,
	opts ...Option,
) *Manager

NewManager creates a new Manager with the given clientset and resync period.

func (*Manager) GetFactory

func (m *Manager) GetFactory() informers.SharedInformerFactory

GetFactory returns the underlying SharedInformerFactory for advanced use cases.

func (*Manager) GetNodeInformer

func (m *Manager) GetNodeInformer() cache.SharedIndexInformer

GetNodeInformer returns the node informer for watching node events.

func (*Manager) GetNodeLister

func (m *Manager) GetNodeLister() listerv1.NodeLister

GetNodeLister returns the node lister for querying the node cache.

func (*Manager) GetPodInformer

func (m *Manager) GetPodInformer() cache.SharedIndexInformer

GetPodInformer returns the pod informer for watching pod events.

func (*Manager) GetPodLister

func (m *Manager) GetPodLister() listerv1.PodLister

GetPodLister returns the pod lister for querying the pod cache.

func (*Manager) GetVAIndexer

func (m *Manager) GetVAIndexer() cache.Indexer

GetVAIndexer returns the VolumeAttachment indexer for indexed lookups. Use with VANodeNameIndexer to look up VolumeAttachments by node name. Returns nil if the VA informer is not available or not synced.

func (*Manager) GetVAInformer

func (m *Manager) GetVAInformer() cache.SharedIndexInformer

GetVAInformer returns the VolumeAttachment informer for watching VA events. Returns nil if the VA informer is not available or not synced.

func (*Manager) GetVALister

GetVALister returns the VolumeAttachment lister for querying the VA cache. Returns nil if the VA informer is not available or not synced.

func (*Manager) IsVAAvailable

func (m *Manager) IsVAAvailable() bool

IsVAAvailable indicates whether the VolumeAttachment informer is available.

func (*Manager) Start

func (m *Manager) Start(ctx context.Context) error

Start starts the informer factory and waits for all caches to sync. This method blocks until caches are synchronized or the context is canceled.

func (*Manager) Stop

func (m *Manager) Stop()

Stop gracefully stops the informer factory.

type Option

type Option func(*Manager)

Option is a functional option for configuring the Manager.

func EnableNodeInformer

func EnableNodeInformer() Option

func EnablePodInformer

func EnablePodInformer() Option

func WithCacheSyncTimeout

func WithCacheSyncTimeout(timeout time.Duration) Option

WithCacheSyncTimeout sets the timeout for waiting for informer caches to sync.

func WithDefaultVANodeNameIndexer

func WithDefaultVANodeNameIndexer() Option

WithDefaultVANodeNameIndexer adds the default spec.nodeName indexer for VolumeAttachments. This is commonly used to look up VolumeAttachments by node name.

func WithNodeIndexers

func WithNodeIndexers(indexers cache.Indexers) Option

WithNodeIndexers sets custom indexers for the node informer.

func WithPodIndexers

func WithPodIndexers(indexers cache.Indexers) Option

WithPodIndexers sets custom indexers for the pod informer.

func WithVAIndexers

func WithVAIndexers(indexers cache.Indexers) Option

WithVAIndexers sets custom indexers for the VolumeAttachment informer.

type VAPermissionError

type VAPermissionError struct {
	// MissingVerb is the verb that was denied (e.g., "get", "list", "watch").
	MissingVerb string
}

VAPermissionError indicates that required RBAC permissions for VolumeAttachments are missing.

func (*VAPermissionError) Error

func (e *VAPermissionError) Error() string

Jump to

Keyboard shortcuts

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