Documentation
¶
Overview ¶
pkg/informer/factory.go
Index ¶
- type ClientProvider
- type Factory
- func (f *Factory) For(obj runtime.Object, ctx context.Context, opts Options) cache.SharedIndexInformer
- func (f *Factory) ForListerWatcher(lw cache.ListerWatcher, obj runtime.Object, ctx context.Context, opts Options) cache.SharedIndexInformer
- func (f *Factory) IsMissing(key string) bool
- func (f *Factory) IsReady() bool
- func (f *Factory) Missing() map[string]*InformerEntry
- func (f *Factory) Name() string
- func (f *Factory) Registered() map[string]*InformerEntry
- func (f *Factory) RemoveMissing(gvkStr string)
- func (f *Factory) SetMissingOnStartup(missing map[string]*InformerEntry)
- func (f *Factory) Shutdown(ctx context.Context)
- func (f *Factory) Start(ctx context.Context) error
- func (f *Factory) Started() bool
- func (f *Factory) Status() string
- func (f *Factory) WaitForCacheSync(ctx context.Context) bool
- type GenericClient
- type InformerEntry
- type Options
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ClientProvider ¶
type ClientProvider interface {
For(obj runtime.Object) (GenericClient, error)
}
type Factory ¶
type Factory struct {
// contains filtered or unexported fields
}
All mappings key: gvk
func SharedInformerFactory ¶
func (*Factory) For ¶
func (f *Factory) For(obj runtime.Object, ctx context.Context, opts Options) cache.SharedIndexInformer
For creates or returns a SharedIndexInformer for the given object type. Uses the client provider to build the ListerWatcher via newListWatch. Each type gets exactly one informer — subsequent calls return the cached one. The informer is not started here — Start() starts all registered informers.
func (*Factory) ForListerWatcher ¶
func (f *Factory) ForListerWatcher(lw cache.ListerWatcher, obj runtime.Object, ctx context.Context, opts Options) cache.SharedIndexInformer
ForListerWatcher creates or returns a SharedIndexInformer using an explicit ListerWatcher. Used for unstructured CRDs where the dynamic client provides the ListerWatcher directly, bypassing the typed client provider entirely. The scheme is never consulted — no conversion errors for unstructured types.
func (*Factory) Missing ¶
func (f *Factory) Missing() map[string]*InformerEntry
Missing CRDs on startup
func (*Factory) Registered ¶
func (f *Factory) Registered() map[string]*InformerEntry
Registered CRDs
func (*Factory) RemoveMissing ¶
RemoveMissing CRDs in between runs
func (*Factory) SetMissingOnStartup ¶
func (f *Factory) SetMissingOnStartup(missing map[string]*InformerEntry)
SetMissing CRDs on startup
func (*Factory) Start ¶
Start signals readiness and starts all registered informers. Must be called exactly once — enforced by ErrFactoryAlreadyStarted.
func (*Factory) Status ¶
Status returns a summary of all informers and their sync state. Used by the health server /katalog endpoint.
func (*Factory) WaitForCacheSync ¶
WaitForCacheSync blocks until all informer caches have synced or ctx is done. It only waits on informers that were successfully created and started. Informers for missing CRDs (where ListWatch failed) should never be added to the factory, so they are naturally excluded here.
type GenericClient ¶
type InformerEntry ¶
type InformerEntry struct {
Informer cache.SharedIndexInformer
Name string
Resync time.Duration
Missing bool
GVK *schema.GroupVersionKind
// Store the context and cancel function
Ctx context.Context // stored context
Cancel context.CancelFunc // stored cancel function
WasNeverStarted bool
}
InformerEntry holds an informer and its metadata — avoids storing a single shared opts on the factory which caused the name bug.