Documentation
¶
Index ¶
- type Manager
- func (m *Manager[T]) CurrentConfig() *T
- func (m *Manager[T]) LoadInitial(ctx context.Context) error
- func (m *Manager[T]) Reconcile(ctx context.Context, req reconcile.Request) (reconcile.Result, error)
- func (m *Manager[T]) ResetToDefault()
- func (m *Manager[T]) SetAPIReader(reader client.Reader)
- func (m *Manager[T]) SetupWithManager(mgr ctrl.Manager) error
- type Options
- type ReloadReason
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Manager ¶
type Manager[T any] struct { // contains filtered or unexported fields }
Manager encapsulates shared ConfigMap loading, caching, and reconcile logic for operator configuration structs.
func NewManager ¶
NewManager constructs a Manager with the provided options.
func (*Manager[T]) CurrentConfig ¶
func (m *Manager[T]) CurrentConfig() *T
CurrentConfig returns a cloned snapshot of the cached configuration.
func (*Manager[T]) LoadInitial ¶
LoadInitial synchronously loads the ConfigMap before the manager starts.
func (*Manager[T]) Reconcile ¶
func (m *Manager[T]) Reconcile(ctx context.Context, req reconcile.Request) (reconcile.Result, error)
Reconcile reacts to ConfigMap updates/deletes and refreshes the cache.
func (*Manager[T]) ResetToDefault ¶
func (m *Manager[T]) ResetToDefault()
ResetToDefault replaces the cached configuration with the default snapshot.
func (*Manager[T]) SetAPIReader ¶
SetAPIReader injects a non-cached reader for startup scenarios.
type Options ¶
type Options[T any] struct { Client client.Client Logger logr.Logger ConfigMapKey types.NamespacedName ControllerName string DefaultConfig func() *T ParseConfigMap func(*corev1.ConfigMap) (*T, error) CloneConfig func(*T) *T ApplyConfig func(*T) OnConfigApplied func(ReloadReason, *T) }
Options configures a Manager instance for a concrete operator config type.
type ReloadReason ¶
type ReloadReason string
ReloadReason identifies why the configuration was reloaded.
const ( // ReloadReasonInitial indicates the initial synchronous load at startup. ReloadReasonInitial ReloadReason = "initial" // ReloadReasonReconcile indicates a reload triggered by the controller watch. ReloadReasonReconcile ReloadReason = "reconcile" )