testwatcher

package
v1.19.0-rc.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 8, 2024 License: Apache-2.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

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.

func WatchUnstructured added in v1.16.0

func WatchUnstructured() WatchOption

WatchUnstructured tells the watcher to used unstructured objects, instead of the default typed objects.

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL