waiter

package
v1.21.0 Latest Latest
Warning

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

Go to latest
Published: Oct 27, 2026 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Overview

Package waiter watches API objects until they reach a desired state, showing the progress with a spinner.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Message

type Message struct {
	Icon     string
	Text     string
	Disabled bool
}

Message is a progress message shown during or after a stage.

func (*Message) Progress

func (m *Message) Progress() string

Progress returns the message formatted as progress, or "" if it is disabled.

type ResultFunc

type ResultFunc func(watch.Event) (bool, error)

ResultFunc is the function called on a watch event during a wait. It should return true whenever the wait can be considered done.

type Stage

type Stage struct {
	Kind        string
	WaitMessage *Message
	DoneMessage *Message
	ObjectList  runtimeclient.ObjectList
	ListOpts    []runtimeclient.ListOption
	OnResult    ResultFunc

	DisableSpinner bool

	// BeforeWait is a hook that is called just before the wait is being run.
	BeforeWait func()
	// AfterWait is a hook that is called after the wait to clean up.
	AfterWait func()
	// contains filtered or unexported fields
}

Stage is a single wait for an object list watch to report a desired state.

type Waiter

type Waiter struct {
	format.Writer

	Client *api.Client
	Kind   string
	Object runtimeclient.Object
}

Waiter runs wait stages for a single object. Stages that leave Kind or ListOpts empty default to the Kind and the Object of the Waiter.

func (*Waiter) Wait

func (wa *Waiter) Wait(ctx context.Context, stages ...Stage) error

Wait runs the stages one after the other until all are done, one of them fails or ctx is done.

Jump to

Keyboard shortcuts

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