Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CreateWatchObject ¶
type CreateWatchObject func(namespace string) (WatchObject, error)
CreateWatchObject - A function that creates a WatchObject to be watched (monitored)
type ObjectMonitor ¶
type ObjectMonitor struct {
// contains filtered or unexported fields
}
ObjectMonitor - Watches a particular kubernetes object through k8s API
func NewObjectMonitor ¶
func NewObjectMonitor(ctx context.Context, name string, namespace string, handler WatchEventHandler, create CreateWatchObject) (*ObjectMonitor, error)
NewObjectMonitor - param name: name of the k8s object to monitor param namespace: namespace of the object to monitor param create: func that creates the specific type of k8s object for monitoring purposes (e.g. v1.SecretInterface) param handler: handles watch events generated by the monitor
func (*ObjectMonitor) Start ¶
func (om *ObjectMonitor) Start(ctx context.Context)
Start - Starts monitoring the object, and relays events to handler Note: blocks caller
func (*ObjectMonitor) Stop ¶
func (om *ObjectMonitor) Stop(ctx context.Context)
Stop - Stops the object monitor, and signals event handler
type ObjectMonitorInterface ¶
type ObjectMonitorManager ¶
type ObjectMonitorManager struct {
// contains filtered or unexported fields
}
ObjectMonitorManager - Allows watching multiple k8s objects of the same type in the same namespace through k8s API
func NewObjectMonitorManager ¶
func NewObjectMonitorManager(ctx context.Context, namespace string, handler WatchEventHandler, create CreateWatchObject) *ObjectMonitorManager
type WatchEventHandler ¶
type WatchEventHandler interface { Handle(ctx context.Context, event *watch.Event) End(ctx context.Context, namespace, name string) }
WatchEventHandler - Handles watch events relayed by Monitor TODO: check if End() could be changed to accept *watch.Event
type WatchObject ¶
type WatchObject interface {
Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error)
}
WatchObject - Is a wrapper around Watch (implemented by v1.SecretInterface, v1.PodInterface etc.)