Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Controller ¶
type Converter ¶
type Converter interface { // ConvertObject takes an object and returns the modified object which will be // stored in the data store ConvertObject(originalObj interface{}) (convertedObj interface{}, err error) // ConvertList takes an object and returns the modified list of objects which // will be returned to the Simple Pager function to aggregate the list pagination // response ConvertList(originalList interface{}) (convertedList interface{}, err error) // Resource returns the K8s resource name to list/watch Resource() string // ResourceType returns the k8s object to list/watch ResourceType() runtime.Object }
Converter for converting k8s object and object list used in watches and list operation
type CustomController ¶
type CustomController struct { // ClientSet is the kubernetes client set ClientSet *kubernetes.Clientset // PageLimit is the number of objects returned per page on a list operation PageLimit int64 // Namespace to list/watch for Namespace string // Converter is the converter implementation that converts the k8s // object before storing in the data store Converter Converter // ResyncPeriod how often to sync using list with the API Server ResyncPeriod time.Duration // RetryOnError weather item should be retried on error. Should remain false in usual use case RetryOnError bool // Queue is the Delta FIFO queue Queue *cache.DeltaFIFO // CreateUpdateEventNotificationChan channel will be notified for all create and update // events for the k8s resource. If we don't want memory usage spikes we should // process the events as soon as soon as the channel is notified. CreateUpdateEventNotificationChan chan event.GenericEvent // DeleteEventNotificationChan channel will be notified for all delete events for the // k8s resource. If we don't want memory usage spikes we should process the events as // soon as soon as the channel is notified. DeleteEventNotificationChan chan event.GenericEvent // SkipCacheDeletion will not delete the entry from cache on receiving a Delete event. // The k8s object should be deleted by the routine listing for delete events on the delete // event chanel. This is useful for kube builder controller which provides API with just the // namespace + name without returning the entire object from the event SkipCacheDeletion bool // Log for custom controller Log logr.Logger // Controller is the K8s Controller Controller cache.Controller // contains filtered or unexported fields }
func (*CustomController) GetDataStore ¶
func (c *CustomController) GetDataStore() cache.Indexer
GetDataStore returns the data store when it has successfully synced with API Server
func (*CustomController) StartController ¶
func (c *CustomController) StartController(dataStore cache.Indexer, stopChanel chan struct{})
StartController starts the custom controller by doing a list and watch on the specified k8s resource. The controller would store the converted k8s object in the provided indexer. The stop channel should be notified to stop the controller
Click to show internal directories.
Click to hide internal directories.