Documentation ¶
Index ¶
- type AddFunction
- type ControllerSwitch
- type Manager
- func (wm *Manager) GetManagedGVK() []schema.GroupVersionKind
- func (wm *Manager) NewRegistrar(parent string, events chan<- event.GenericEvent) (*Registrar, error)
- func (wm *Manager) OnAdd(obj interface{})
- func (wm *Manager) OnDelete(obj interface{})
- func (wm *Manager) OnUpdate(oldObj, newObj interface{})
- func (wm *Manager) RemoveRegistrar(parentName string) error
- func (wm *Manager) Start(ctx context.Context) error
- type Registrar
- type RemovableCache
- type Set
- func (w *Set) Add(gvks ...schema.GroupVersionKind)
- func (w *Set) AddSet(other *Set)
- func (w *Set) Contains(gvk schema.GroupVersionKind) bool
- func (w *Set) Difference(other *Set) *Set
- func (w *Set) DoForEach(f func(gvk schema.GroupVersionKind) error) error
- func (w *Set) Dump() map[schema.GroupVersionKind]bool
- func (w *Set) Equals(other *Set) bool
- func (w *Set) Intersection(other *Set) *Set
- func (w *Set) Items() []schema.GroupVersionKind
- func (w *Set) RLock()
- func (w *Set) RUnlock()
- func (w *Set) Remove(gvks ...schema.GroupVersionKind)
- func (w *Set) RemoveSet(other *Set)
- func (w *Set) Replace(other *Set, fns ...func())
- func (w *Set) Size() int
- func (w *Set) String() string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AddFunction ¶
type ControllerSwitch ¶
type ControllerSwitch struct {
// contains filtered or unexported fields
}
func NewSwitch ¶
func NewSwitch() *ControllerSwitch
func (*ControllerSwitch) Enter ¶
func (c *ControllerSwitch) Enter() bool
func (*ControllerSwitch) Exit ¶
func (c *ControllerSwitch) Exit()
func (*ControllerSwitch) Stop ¶
func (c *ControllerSwitch) Stop()
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
Manager allows us to dynamically configure what kinds are watched.
func New ¶
func New(c RemovableCache) (*Manager, error)
func (*Manager) GetManagedGVK ¶
func (wm *Manager) GetManagedGVK() []schema.GroupVersionKind
func (*Manager) NewRegistrar ¶
func (*Manager) OnAdd ¶
func (wm *Manager) OnAdd(obj interface{})
OnAdd implements cache.ResourceEventHandler. Called by informers.
func (*Manager) OnDelete ¶
func (wm *Manager) OnDelete(obj interface{})
OnDelete implements cache.ResourceEventHandler. Called by informers.
func (*Manager) OnUpdate ¶
func (wm *Manager) OnUpdate(oldObj, newObj interface{})
OnUpdate implements cache.ResourceEventHandler. Called by informers.
func (*Manager) RemoveRegistrar ¶
RemoveRegistrar removes a registrar and all its watches.
type Registrar ¶
type Registrar struct {
// contains filtered or unexported fields
}
A Registrar allows a parent to add/remove child watches.
func (*Registrar) AddWatch ¶
func (r *Registrar) AddWatch(gvk schema.GroupVersionKind) error
AddWatch registers a watch for the given kind.
AddWatch will only block if all of the following are true:
- The registrar is joining an existing watch
- The registrar's event channel does not have sufficient capacity to receive existing resources
- The consumer of the channel does not receive any unbuffered events.
XXXX also may block if the watch manager has not been started.
func (*Registrar) IfWatching ¶
IfWatching executes the passed function if the provided GVK is being watched by the registrar, ignoring it if not. It returns whether the function was executed and any errors returned by the executed function.
func (*Registrar) RemoveWatch ¶
func (r *Registrar) RemoveWatch(gvk schema.GroupVersionKind) error
RemoveWatch removes a watch for the given kind. Ignores the request if the kind was not previously watched.
func (*Registrar) ReplaceWatch ¶
func (r *Registrar) ReplaceWatch(gvks []schema.GroupVersionKind) error
ReplaceWatch replaces the set of watched resources.
type RemovableCache ¶
type RemovableCache interface { GetInformerNonBlocking(obj client.Object) (cache.Informer, error) List(ctx context.Context, list client.ObjectList, opts ...client.ListOption) error Remove(obj client.Object) error }
RemovableCache is a subset variant of the cache.Cache interface. It supports non-blocking calls to get informers, as well as the ability to remove an informer dynamically.
type Set ¶
type Set struct {
// contains filtered or unexported fields
}
Set tracks a set of watched resource GVKs.
func (*Set) Add ¶
func (w *Set) Add(gvks ...schema.GroupVersionKind)
func (*Set) Difference ¶
Difference returns items in the set that are not in the other (provided) set.
func (*Set) DoForEach ¶
func (w *Set) DoForEach(f func(gvk schema.GroupVersionKind) error) error
DoForEach locks Set to prevent mutations and executes f on every element currently in the set. Exits early if f returns an error.
func (*Set) Intersection ¶
Intersection returns a set composed of all items that are both in set w and other.
func (*Set) Items ¶
func (w *Set) Items() []schema.GroupVersionKind
func (*Set) Remove ¶
func (w *Set) Remove(gvks ...schema.GroupVersionKind)