Documentation ¶
Overview ¶
Package controller implements the controller pattern.
Index ¶
- type Cluster
- type Controller
- func (c *Controller) GetCaches() manager.CacheSet
- func (c *Controller) Start(stop <-chan struct{}) error
- func (c *Controller) WatchResourceReconcileController(cluster Cluster, objectType runtime.Object, o WatchOptions) error
- func (c *Controller) WatchResourceReconcileObject(cluster Cluster, objectType runtime.Object, o WatchOptions) error
- type Options
- type WatchOptions
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Cluster ¶
type Cluster interface { GetContext() string AddEventHandler(runtime.Object, cache.ResourceEventHandler) error manager.Cache }
Cluster decouples the controller package from the cluster package.
type Controller ¶
type Controller struct { Options // contains filtered or unexported fields }
Controller implements the controller pattern. A Controller owns a client-go workqueue. Watch methods set up the queue to receive reconcile Requests, e.g., on resource CRUD events in a cluster. The Requests are processed by the user-provided Reconciler. A Controller can watch multiple resources in multiple clusters. It saves those clusters in a set, so the Manager knows which caches to start and sync before starting the Controller.
func (*Controller) GetCaches ¶
func (c *Controller) GetCaches() manager.CacheSet
GetCaches gets the current set of clusters (which implement manager.Cache) watched by the Controller. Manager uses this to ensure the necessary caches are started and synced before it starts the Controller.
func (*Controller) Start ¶
func (c *Controller) Start(stop <-chan struct{}) error
Start starts the Controller's control loops (as many as MaxConcurrentReconciles) in separate channels and blocks until an empty struct is sent to the stop channel.
func (*Controller) WatchResourceReconcileController ¶
func (c *Controller) WatchResourceReconcileController(cluster Cluster, objectType runtime.Object, o WatchOptions) error
WatchResourceReconcileController configures the Controller to watch resources of the same Kind as objectType, in the specified cluster, generating reconcile Requests from the Cluster's context and the namespaces and names of the watched objects' controller references.
func (*Controller) WatchResourceReconcileObject ¶
func (c *Controller) WatchResourceReconcileObject(cluster Cluster, objectType runtime.Object, o WatchOptions) error
WatchResourceReconcileObject configures the Controller to watch resources of the same Kind as objectType, in the specified cluster, generating reconcile Requests from the Cluster's context and the watched objects' namespaces and names.
type Options ¶
type Options struct { // JitterPeriod is the time to wait after an error to start working again. JitterPeriod time.Duration // MaxConcurrentReconciles is the number of concurrent control loops. // Use this if your Reconciler is slow, but thread safe. MaxConcurrentReconciles int // Queue can be used to override the default queue. Queue workqueue.RateLimitingInterface // Logger can be used to override the default logger. Logger *log.Logger }
Options is used as an argument of New.
type WatchOptions ¶
type WatchOptions struct { }
WatchOptions is used as an argument of WatchResource methods (just a placeholder for now). TODO: consider implementing predicates.