Documentation ¶
Index ¶
- type AddFunction
- type ControllerSwitch
- type ErrorList
- func (e *ErrorList) AddGVKErr(gvk schema.GroupVersionKind, err error)
- func (e *ErrorList) AddGVKFailures() []schema.GroupVersionKind
- func (e *ErrorList) Err(err error)
- func (e *ErrorList) Error() string
- func (e *ErrorList) HasGeneralErr() bool
- func (e *ErrorList) RemoveGVKErr(gvk schema.GroupVersionKind, err error)
- func (e *ErrorList) RemoveGVKFailures() []schema.GroupVersionKind
- func (e *ErrorList) Size() int
- func (e *ErrorList) String() string
- 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{}, _ bool)
- 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
- func (r *Registrar) AddWatch(ctx context.Context, gvk schema.GroupVersionKind) error
- func (r *Registrar) IfWatching(gvk schema.GroupVersionKind, fn func() error) (bool, error)
- func (r *Registrar) RemoveWatch(ctx context.Context, gvk schema.GroupVersionKind) error
- func (r *Registrar) ReplaceWatch(ctx context.Context, gvks []schema.GroupVersionKind) error
- 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 ErrorList ¶ added in v3.15.0
type ErrorList struct {
// contains filtered or unexported fields
}
ErrorList is an error that aggregates multiple errors.
func NewErrorList ¶ added in v3.15.0
func NewErrorList() *ErrorList
func (*ErrorList) AddGVKErr ¶ added in v3.15.0
func (e *ErrorList) AddGVKErr(gvk schema.GroupVersionKind, err error)
adds a gvk specific error for failing to add a gvk watch to the list.
func (*ErrorList) AddGVKFailures ¶ added in v3.15.0
func (e *ErrorList) AddGVKFailures() []schema.GroupVersionKind
Return gvks for which there were errors adding watches.
func (*ErrorList) HasGeneralErr ¶ added in v3.15.0
func (*ErrorList) RemoveGVKErr ¶ added in v3.15.0
func (e *ErrorList) RemoveGVKErr(gvk schema.GroupVersionKind, err error)
adds a gvk specific error for failing to remove a gvk watch to the list.
func (*ErrorList) RemoveGVKFailures ¶ added in v3.15.0
func (e *ErrorList) RemoveGVKFailures() []schema.GroupVersionKind
Return gvks for which there were errors removing watches.
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) 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 ¶
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 ¶
RemoveWatch removes a watch for the given kind. Ignores the request if the kind was not previously watched.
func (*Registrar) ReplaceWatch ¶
ReplaceWatch replaces the set of watched resources.
type RemovableCache ¶
type RemovableCache interface { GetInformer(_ context.Context, obj client.Object, opts ...cache.InformerGetOption) (cache.Informer, error) List(ctx context.Context, list client.ObjectList, opts ...client.ListOption) error RemoveInformer(_ context.Context, 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 SetFrom ¶ added in v3.15.0
func SetFrom(items []schema.GroupVersionKind) *Set
SetFrom constructs a new watchSet from the given 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)