Documentation
¶
Overview ¶
Package framework provides a generic controller implementation for managing the lifecycle of controllers that are scoped to ProviderConfig resources.
It handles watching ProviderConfig resources, ensuring finalizers are present, and starting/stopping the associated controllers using a provided ControllerStarter implementation.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Controller ¶
type Controller struct {
// contains filtered or unexported fields
}
Controller manages the ProviderConfig resource lifecycle. It watches for ProviderConfig changes and delegates to the manager to start/stop controllers for each ProviderConfig.
func New ¶
func New(client dynamic.Interface, providerConfigInformer cache.SharedIndexInformer, finalizerName string, controllerStarter ControllerStarter, stopCh <-chan struct{}, ) *Controller
New creates a new Controller that manages ProviderConfig resources.
func (*Controller) Run ¶
func (c *Controller) Run()
Run starts the controller and blocks until the stop channel is closed.
type ControllerMap ¶
type ControllerMap struct {
// contains filtered or unexported fields
}
ControllerMap is a thread-safe map for storing ControllerSet instances. It uses read-write locking to allow concurrent read operations.
func NewControllerMap ¶
func NewControllerMap() *ControllerMap
NewControllerMap creates a new thread-safe ControllerMap.
func (*ControllerMap) Delete ¶
func (cm *ControllerMap) Delete(key string)
Delete removes the ControllerSet for the given key.
func (*ControllerMap) Get ¶
func (cm *ControllerMap) Get(key string) (*ControllerSet, bool)
Get retrieves a ControllerSet for the given key. Returns the ControllerSet and a boolean indicating whether it exists.
func (*ControllerMap) GetOrCreate ¶
func (cm *ControllerMap) GetOrCreate(key string) (*ControllerSet, bool)
GetOrCreate retrieves the ControllerSet for the given key, creating a new entry when absent. The second return value indicates whether the ControllerSet already existed.
type ControllerSet ¶
type ControllerSet struct {
// contains filtered or unexported fields
}
ControllerSet holds controller-specific resources for a ProviderConfig. It contains the stop channel used to signal controller shutdown.
type ControllerStarter ¶
type ControllerStarter interface {
// StartController starts controller(s) for the given ProviderConfig.
// Returns:
// - A channel that should be closed to stop the controller
// - An error if startup fails
//
// The returned stop channel will be closed by the framework when the
// ProviderConfig is deleted or the controller needs to shut down.
StartController(pc *providerconfigv1.ProviderConfig) (chan<- struct{}, error)
}
ControllerStarter defines the interface for starting a controller for a ProviderConfig. Implementations encapsulate all controller-specific startup logic and dependencies.