k8s v0.5.2 K8s.Client.Runner.Wait

Waiting functionality for K8s.Client.

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

Link to this section Summary

Types

t()

A wait configuration

Functions

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

Link to this section Types

Link to this type

t()

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

A wait configuration

Link to this section Functions

Link to this function

run(op, conn, opts)

run(K8s.Operation.t(), binary(), keyword(atom())) ::
  {:ok, map()} | {:error, binary()}

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

Example

Checking the number of job completions:

op = K8s.Client.get("batch/v1", :job, namespace: "default", name: "sleep")
opts = [find: ["status", "succeeded"], eval: 1, timeout: 60]
conn = K8s.Conn.lookup(:my_cluster)
resp = K8s.Client.Runner.Wait.run(op, conn, opts)