View Source K8s.Client.Runner.Wait (k8s v2.4.2)

Waiting functionality for K8s.Client.

Note: This is built using repeated GET operations rather than using a watch operation w/ fieldSelector.

Summary

Types

t()

A wait configuration

Functions

Continually perform a GET based operation until a condition is met.

Types

@type t() :: %K8s.Client.Runner.Wait{
  eval: any() | (any() -> any()),
  find: [binary()] | (any() -> any()),
  processor: (map(), map() -> {:ok, map()} | {:error, K8s.Operation.Error.t()}),
  sleep: pos_integer(),
  timeout: pos_integer(),
  timeout_after: NaiveDateTime.t()
}

A wait configuration

Functions

@spec run(
  K8s.Operation.t(),
  keyword()
) ::
  {:ok, :deleted} | {:ok, map()} | {:error, :timeout | K8s.Operation.Error.t()}

Continually perform a GET based operation until a condition is met.

Example

This follow example will wait 60 seconds for the field status.succeeded to equal 1.

op = K8s.Client.get("batch/v1", :job, namespace: "default", name: "sleep")
opts = [find: ["status", "succeeded"], eval: 1, timeout: 60]
{:ok, conn} = K8s.Conn.from_file("test/support/kube-config.yaml")
resp = K8s.Client.Runner.Wait.run(conn, op, opts)
@spec run(K8s.Conn.t(), K8s.Operation.t(), keyword()) ::
  {:ok, :deleted} | {:ok, map()} | {:error, :timeout | K8s.Operation.Error.t()}