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
- type Client
- func (c *Client) WaitGone(ctx context.Context, gvk schema.GroupVersionKind, namespace, name string, ...) error
- func (c *Client) WaitReady(ctx context.Context, gvk schema.GroupVersionKind, namespace, name string, ...) (*unstructured.Unstructured, error)
- func (c *Client) WaitReadyWithPhase(ctx context.Context, gvk schema.GroupVersionKind, namespace, name string, ...) (*unstructured.Unstructured, error)
Constants ¶
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 New(getter genericclioptions.RESTClientGetter) (*Client, error)
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.