Documentation
¶
Index ¶
- func AddCacheCheckpointWaitReconciler(mgr ctrl.Manager, waitHooks *sync.Map) error
- func AddCacheSandboxWaitReconciler(mgr ctrl.Manager, waitHooks *sync.Map) error
- func NewCheckpoint() *agentsv1alpha1.Checkpoint
- func NewSandbox() *agentsv1alpha1.Sandbox
- func NewSandboxSet() *agentsv1alpha1.SandboxSet
- type CacheCheckpointWaitReconciler
- type CacheControllerHandlers
- type CacheSandboxCustomReconciler
- type CacheSandboxSetCustomReconciler
- type CacheSandboxWaitReconciler
- type CustomReconcileHandler
- type CustomReconciler
- type MockManager
- func (m *MockManager) Add(manager.Runnable) error
- func (m *MockManager) AddHealthzCheck(_ string, _ healthz.Checker) error
- func (m *MockManager) AddMetricsServerExtraHandler(_ string, _ http.Handler) error
- func (m *MockManager) AddReadyzCheck(_ string, _ healthz.Checker) error
- func (m *MockManager) AddWaitReconcileKey(obj client.Object)
- func (m *MockManager) Elected() <-chan struct{}
- func (m *MockManager) GetAPIReader() client.Reader
- func (m *MockManager) GetCache() ctrlcache.Cache
- func (m *MockManager) GetClient() client.Client
- func (m *MockManager) GetConfig() *rest.Config
- func (m *MockManager) GetControllerOptions() ctrlcfg.Controller
- func (m *MockManager) GetEventRecorderFor(_ string) record.EventRecorder
- func (m *MockManager) GetFieldIndexer() client.FieldIndexer
- func (m *MockManager) GetHTTPClient() *http.Client
- func (m *MockManager) GetLogger() logr.Logger
- func (m *MockManager) GetRESTMapper() apimeta.RESTMapper
- func (m *MockManager) GetScheme() *runtime.Scheme
- func (m *MockManager) GetWebhookServer() webhook.Server
- func (m *MockManager) SetWaitHooks(hooks *sync.Map)
- func (m *MockManager) Start(ctx context.Context) error
- func (m *MockManager) StartCallsCount() int
- type MockManagerBuilder
- func (b *MockManagerBuilder) Build() *MockManager
- func (b *MockManagerBuilder) WithClient(c client.Client) *MockManagerBuilder
- func (b *MockManagerBuilder) WithFailOnNthAdd(n int, err error) *MockManagerBuilder
- func (b *MockManagerBuilder) WithScheme(s *runtime.Scheme) *MockManagerBuilder
- func (b *MockManagerBuilder) WithWaitSimulation(objs ...client.Object) *MockManagerBuilder
- type WaitReconciler
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddCacheCheckpointWaitReconciler ¶
AddCacheCheckpointWaitReconciler creates and registers the CacheCheckpointWaitReconciler with the manager.
func AddCacheSandboxWaitReconciler ¶
AddCacheSandboxWaitReconciler creates and registers the CacheSandboxWaitReconciler with the manager.
func NewCheckpoint ¶
func NewCheckpoint() *agentsv1alpha1.Checkpoint
func NewSandbox ¶
func NewSandbox() *agentsv1alpha1.Sandbox
func NewSandboxSet ¶
func NewSandboxSet() *agentsv1alpha1.SandboxSet
Types ¶
type CacheCheckpointWaitReconciler ¶
type CacheCheckpointWaitReconciler struct {
WaitReconciler[*agentsv1alpha1.Checkpoint]
}
CacheCheckpointWaitReconciler reconciles Checkpoint objects to check wait hooks. It replicates the logic of addWaiterHandler[*agentsv1alpha1.Checkpoint].
func (*CacheCheckpointWaitReconciler) SetupWithManager ¶
func (r *CacheCheckpointWaitReconciler) SetupWithManager(mgr ctrl.Manager) error
SetupWithManager sets up the controller with the Manager.
type CacheControllerHandlers ¶
type CacheControllerHandlers struct {
SandboxCustomReconciler *CacheSandboxCustomReconciler
SandboxSetCustomReconciler *CacheSandboxSetCustomReconciler
}
CacheControllerHandlers holds references to the custom reconcilers so that external callers can register event handlers via AddEventHandler.
func SetupCacheControllersWithManager ¶
func SetupCacheControllersWithManager(mgr manager.Manager, waitHooks *sync.Map) (*CacheControllerHandlers, error)
SetupCacheControllersWithManager registers all cache controllers with the given manager and returns a CacheControllerHandlers struct for registering custom event handlers. The waitHooks parameter is shared with the Cache instance.
type CacheSandboxCustomReconciler ¶
type CacheSandboxCustomReconciler struct {
CustomReconciler[*agentsv1alpha1.Sandbox]
}
CacheSandboxCustomReconciler reconciles Sandbox objects and dispatches events to registered CustomReconcileHandler. It corresponds to the original AddSandboxEventHandler functionality.
func AddCacheSandboxCustomReconciler ¶
func AddCacheSandboxCustomReconciler(mgr ctrl.Manager) (*CacheSandboxCustomReconciler, error)
AddCacheSandboxCustomReconciler creates and registers the CacheSandboxCustomReconciler with the manager. It returns the reconciler instance so callers can register event handlers via AddReconcileHandlers.
func (*CacheSandboxCustomReconciler) SetupWithManager ¶
func (r *CacheSandboxCustomReconciler) SetupWithManager(mgr ctrl.Manager) error
SetupWithManager sets up the controller with the Manager.
type CacheSandboxSetCustomReconciler ¶
type CacheSandboxSetCustomReconciler struct {
CustomReconciler[*agentsv1alpha1.SandboxSet]
}
CacheSandboxSetCustomReconciler reconciles SandboxSet objects and dispatches events to registered ResourceEventHandlerFuncs. It corresponds to the original AddSandboxSetEventHandler functionality.
func AddCacheSandboxSetCustomReconciler ¶
func AddCacheSandboxSetCustomReconciler(mgr ctrl.Manager) (*CacheSandboxSetCustomReconciler, error)
AddCacheSandboxSetCustomReconciler creates and registers the CacheSandboxSetCustomReconciler with the manager. It returns the reconciler instance so callers can register event handlers via AddEventHandler.
func (*CacheSandboxSetCustomReconciler) SetupWithManager ¶
func (r *CacheSandboxSetCustomReconciler) SetupWithManager(mgr ctrl.Manager) error
SetupWithManager sets up the controller with the Manager.
type CacheSandboxWaitReconciler ¶
type CacheSandboxWaitReconciler struct {
WaitReconciler[*agentsv1alpha1.Sandbox]
}
CacheSandboxWaitReconciler reconciles Sandbox objects to check wait hooks. It replicates the logic of addWaiterHandler[*agentsv1alpha1.Sandbox].
func (*CacheSandboxWaitReconciler) SetupWithManager ¶
func (r *CacheSandboxWaitReconciler) SetupWithManager(mgr ctrl.Manager) error
SetupWithManager sets up the controller with the Manager.
type CustomReconcileHandler ¶
type CustomReconcileHandler[T client.Object] func(ctx context.Context, obj T, notFound bool) (ctrl.Result, error)
CustomReconcileHandler is a custom reconcile handler.
type CustomReconciler ¶
type CustomReconciler[T client.Object] struct { client.Client Name string Scheme *runtime.Scheme NewObject func() T // contains filtered or unexported fields }
CustomReconciler allows for multiple reconcile handlers to be added to a single controller.
func (*CustomReconciler[T]) AddReconcileHandlers ¶
func (c *CustomReconciler[T]) AddReconcileHandlers(handler ...CustomReconcileHandler[T])
AddReconcileHandlers must be called before controller is started.
type MockManager ¶
type MockManager struct {
// contains filtered or unexported fields
}
MockManager implements manager.Manager for unit testing. It provides controllable Add() behavior to allow error injection on specific calls.
func (*MockManager) Add ¶
func (m *MockManager) Add(manager.Runnable) error
Add records each call and returns addError on the configured nth invocation.
func (*MockManager) AddHealthzCheck ¶
func (m *MockManager) AddHealthzCheck(_ string, _ healthz.Checker) error
func (*MockManager) AddMetricsServerExtraHandler ¶
func (m *MockManager) AddMetricsServerExtraHandler(_ string, _ http.Handler) error
func (*MockManager) AddReadyzCheck ¶
func (m *MockManager) AddReadyzCheck(_ string, _ healthz.Checker) error
func (*MockManager) AddWaitReconcileKey ¶
func (m *MockManager) AddWaitReconcileKey(obj client.Object)
AddWaitReconcileKey registers an object key for periodic wait reconciliation. The key is grouped by object type so only the matching WaitReconciler is invoked.
func (*MockManager) Elected ¶
func (m *MockManager) Elected() <-chan struct{}
func (*MockManager) GetAPIReader ¶
func (m *MockManager) GetAPIReader() client.Reader
func (*MockManager) GetCache ¶
func (m *MockManager) GetCache() ctrlcache.Cache
func (*MockManager) GetClient ¶
func (m *MockManager) GetClient() client.Client
func (*MockManager) GetConfig ¶
func (m *MockManager) GetConfig() *rest.Config
func (*MockManager) GetControllerOptions ¶
func (m *MockManager) GetControllerOptions() ctrlcfg.Controller
GetControllerOptions returns a config with SkipNameValidation=true. This prevents the global name registry inside controller-runtime from causing "controller already exists" failures across test cases that each call SetupCacheControllersWithManager (which registers the same 4 controller names).
func (*MockManager) GetEventRecorderFor ¶
func (m *MockManager) GetEventRecorderFor(_ string) record.EventRecorder
func (*MockManager) GetFieldIndexer ¶
func (m *MockManager) GetFieldIndexer() client.FieldIndexer
func (*MockManager) GetHTTPClient ¶
func (m *MockManager) GetHTTPClient() *http.Client
func (*MockManager) GetLogger ¶
func (m *MockManager) GetLogger() logr.Logger
func (*MockManager) GetRESTMapper ¶
func (m *MockManager) GetRESTMapper() apimeta.RESTMapper
func (*MockManager) GetScheme ¶
func (m *MockManager) GetScheme() *runtime.Scheme
func (*MockManager) GetWebhookServer ¶
func (m *MockManager) GetWebhookServer() webhook.Server
func (*MockManager) SetWaitHooks ¶
func (m *MockManager) SetWaitHooks(hooks *sync.Map)
SetWaitHooks sets the shared waitHooks reference from CacheV2. Must be called before Start().
func (*MockManager) Start ¶
func (m *MockManager) Start(ctx context.Context) error
Start satisfies both cluster.Cluster and manager.Manager.
func (*MockManager) StartCallsCount ¶
func (m *MockManager) StartCallsCount() int
type MockManagerBuilder ¶
type MockManagerBuilder struct {
// contains filtered or unexported fields
}
func NewMockManagerBuilder ¶
func NewMockManagerBuilder(t *testing.T) (*MockManagerBuilder, error)
func (*MockManagerBuilder) Build ¶
func (b *MockManagerBuilder) Build() *MockManager
func (*MockManagerBuilder) WithClient ¶
func (b *MockManagerBuilder) WithClient(c client.Client) *MockManagerBuilder
func (*MockManagerBuilder) WithFailOnNthAdd ¶
func (b *MockManagerBuilder) WithFailOnNthAdd(n int, err error) *MockManagerBuilder
WithFailOnNthAdd specifies which (1-based) call to Add() should return addError.
func (*MockManagerBuilder) WithScheme ¶
func (b *MockManagerBuilder) WithScheme(s *runtime.Scheme) *MockManagerBuilder
func (*MockManagerBuilder) WithWaitSimulation ¶
func (b *MockManagerBuilder) WithWaitSimulation(objs ...client.Object) *MockManagerBuilder
WithWaitSimulation enables WaitReconciler simulation on MockManager. Optionally accepts initial objects whose keys will be periodically reconciled.
type WaitReconciler ¶
type WaitReconciler[T client.Object] struct { client.Client Name string Scheme *runtime.Scheme NewObject func() T // contains filtered or unexported fields }
WaitReconciler is a generic reconciler that checks wait hooks for a specific object type. It replicates the logic of addWaiterHandler[T].