Documentation
¶
Index ¶
- func WatchObject(ctx context.Context, c client.WithWatch, exampleObjList client.ObjectList) (watch.Interface, error)
- func WatchObjectUntil(ctx context.Context, scheme *runtime.Scheme, watcher watch.Interface, ...) error
- func WatchUnstructured(ctx context.Context, c dynamic.Interface, gvr schema.GroupVersionResource) (watch.Interface, error)
- type TerminalError
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func WatchObject ¶
func WatchObject(ctx context.Context, c client.WithWatch, exampleObjList client.ObjectList) (watch.Interface, error)
WatchObject returns a new watcher for a typed resource. The watcher will automatically be stopped when the Context is done.
This is designed for simplified use in tests and is not likely to be suitable for non-test usage.
func WatchObjectUntil ¶
func WatchObjectUntil(ctx context.Context, scheme *runtime.Scheme, watcher watch.Interface, key client.ObjectKey, condition func(watch.Event) error) error
WatchObjectUntil consumes a watcher, filters events to just those for the specified object (by key), and tests each event using the specified condition function. If the condition function returns an error, the watcher will cache the error and continue. If the condition returns nil, the watcher will be stopped and WatchObjectUntil will return nil. If the watcher is stopped, before the condition is met, WatchObjectUntil will return the last cached error from the condition function. WatchObjectUntil also logs object diffs for each event, to facilitate debugging.
This is designed for simplified use in tests and is not likely to be suitable for non-test usage.
func WatchUnstructured ¶
func WatchUnstructured(ctx context.Context, c dynamic.Interface, gvr schema.GroupVersionResource) (watch.Interface, error)
WatchUnstructured returns a new watcher for a dynamic (Unstructured) resource. The watcher will automatically be stopped when the Context is done.
This is designed for simplified use in tests and is not likely to be suitable for non-test usage.
Types ¶
type TerminalError ¶
type TerminalError struct {
Cause error
}
TerminalError will stop WatchObjectUntil if returned by the condition function.
func NewTerminalError ¶
func NewTerminalError(cause error) *TerminalError
NewTerminalError constructs a new TerminalError
func (*TerminalError) Error ¶
func (te *TerminalError) Error() string
Error returns the error message
func (*TerminalError) Unwrap ¶
func (te *TerminalError) Unwrap() error
Unwrap returns the cause of this TerminalError