wait

package
v0.0.0-...-60784e1 Latest Latest
Warning

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

Go to latest
Published: Aug 3, 2026 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Overview

Package wait polls a Kubernetes resource until its Ready=True condition flips, or a timeout fires. Used by deploy between CR apply calls — each platform CR is gated on the previous one being Ready.

Index

Constants

View Source
const PollInterval = 2 * time.Second

PollInterval is how often the waiter re-checks. Kept short to keep the CLI feeling responsive on small clusters; large clusters mostly pay the cost in apiserver list/watch traffic which is negligible.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client polls a resource via dynamic+REST mapping. One Client per deploy run.

func New

func (*Client) WaitGone

func (c *Client) WaitGone(ctx context.Context, gvk schema.GroupVersionKind, namespace, name string, timeout time.Duration) error

WaitGone polls until the resource is 404 or ctx times out. Used by the delete command to gate on a finalizer-driven drain completing before moving to the next CR in reverse-install order.

"Already gone" at first poll is success: idempotent re-runs of delete (or deleting state the deploy never created) shouldn't fail.

func (*Client) WaitReady

func (c *Client) WaitReady(ctx context.Context, gvk schema.GroupVersionKind, namespace, name string, timeout time.Duration) (*unstructured.Unstructured, error)

WaitReady blocks until the object's status.conditions[?(@.type=="Ready")].status is "True", or ctx times out. namespace="" for cluster-scoped resources.

Returns the last-observed object on success — callers use it for the summary line (status.url, status.observedDomain, etc.).

func (*Client) WaitReadyWithPhase

func (c *Client) WaitReadyWithPhase(ctx context.Context, gvk schema.GroupVersionKind, namespace, name string, timeout time.Duration, onPhase func(phase string)) (*unstructured.Unstructured, error)

WaitReadyWithPhase is WaitReady with a callback that fires every time the observed phase changes (or first becomes set). The callback runs on the poll goroutine; reporter implementations are expected to be cheap (write a single status line). A nil callback is equivalent to WaitReady.

Jump to

Keyboard shortcuts

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