Documentation ¶
Index ¶
- func NewFilteredListWatchFromClient(ctx context.Context, c cache.Getter, resource string, namespace string, ...) *cache.ListWatch
- func NewListWatchFromClient(ctx context.Context, c cache.Getter, resource string, namespace string, ...) *cache.ListWatch
- type WatchOption
- type Watcher
- func (w *Watcher) WatchForCurrentStatus(gvk schema.GroupVersionKind, name, namespace string, opts ...WatchOption) error
- func (w *Watcher) WatchForNotFound(gvk schema.GroupVersionKind, name, namespace string, opts ...WatchOption) error
- func (w *Watcher) WatchObject(gvk schema.GroupVersionKind, name, namespace string, ...) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewFilteredListWatchFromClient ¶
func NewFilteredListWatchFromClient(ctx context.Context, c cache.Getter, resource string, namespace string, optionsModifier func(options *metav1.ListOptions)) *cache.ListWatch
NewFilteredListWatchFromClient replaces cache.NewFilteredListWatchFromClient, but adds a context, to allow the List and Watch to be cancelled or time out. https://github.com/kubernetes/client-go/blob/v0.26.3/tools/cache/listwatch.go#L80
func NewListWatchFromClient ¶
func NewListWatchFromClient(ctx context.Context, c cache.Getter, resource string, namespace string, fieldSelector fields.Selector) *cache.ListWatch
NewListWatchFromClient replaces cache.NewListWatchFromClient, but adds a context, to allow the List and Watch to be cancelled or time out. https://github.com/kubernetes/client-go/blob/v0.26.3/tools/cache/listwatch.go#L70
Types ¶
type WatchOption ¶
type WatchOption func(watch *watchSpec)
WatchOption is an optional parameter for Watch
func WatchContext ¶
func WatchContext(ctx context.Context) WatchOption
WatchContext provides the context option to Watch.
func WatchTimeout ¶
func WatchTimeout(timeout time.Duration) WatchOption
WatchTimeout provides the timeout option to Watch.
type Watcher ¶
type Watcher struct {
// contains filtered or unexported fields
}
Watcher is used for performing various Watch operations on k8s objects in the cluster Uses the provided kubeClient/restConfig to set up the Watches
func NewWatcher ¶
func NewWatcher( ctx context.Context, logger *testlogger.TestLogger, kubeClient *testkubeclient.KubeClient, restConfig *rest.Config, scheme *runtime.Scheme, defaultWaitTimeout *time.Duration, ) *Watcher
NewWatcher constructs a new Watcher
func (*Watcher) WatchForCurrentStatus ¶
func (w *Watcher) WatchForCurrentStatus(gvk schema.GroupVersionKind, name, namespace string, opts ...WatchOption) error
WatchForCurrentStatus watches the object until it reconciles (Current).
func (*Watcher) WatchForNotFound ¶
func (w *Watcher) WatchForNotFound(gvk schema.GroupVersionKind, name, namespace string, opts ...WatchOption) error
WatchForNotFound waits for the passed object to be fully deleted or not found. Returns an error if the object is not deleted before the timeout.
func (*Watcher) WatchObject ¶
func (w *Watcher) WatchObject(gvk schema.GroupVersionKind, name, namespace string, predicates []testpredicates.Predicate, opts ...WatchOption) error
WatchObject watches the specified object util all predicates return nil, or the timeout is reached. Object does not need to exist yet, as long as the resource type exists. All Predicates need to handle nil objects (nil means Not Found). If no Predicates are specified, WatchObject watches until the object exists.