Tank.Pod (Tank v0.1.0)

Copy Markdown View Source

A pod's desired state: one or more containers sharing a single network namespace, the pod-level network and volumes, and a restart policy. The pod name is the unique key (the Khepri path leaf under [:tank, :pods, name]).

  • containers — 1+ Tank.Containers, unique by name, sharing the netns.
  • network — a Tank.Pod.Network (the netns is the pod), or the shortcuts :host (share the host netns) / :none (isolated, loopback only).
  • volumes — pod-level Tank.Volumes; every container Tank.Mount must reference one by name.
  • restart:always | :on_failure | :never (the reconciler owns backoff).

new/1 accepts plain maps/keywords for the nested structs and normalises the whole tree, so a hand-authored runtime.exs pod spec validates in one call.

Summary

Functions

Build a validated pod (and its whole nested tree) from a map or keyword list.

Like new/1 but raises ArgumentError on invalid input.

Types

network()

@type network() :: Tank.Pod.Network.t() | :host | :none

t()

@type t() :: %Tank.Pod{
  containers: [Tank.Container.t()],
  name: String.t(),
  network: network(),
  restart: :always | :on_failure | :never,
  volumes: [Tank.Volume.t()]
}

Functions

new(attrs)

@spec new(map() | keyword()) :: {:ok, t()} | {:error, term()}

Build a validated pod (and its whole nested tree) from a map or keyword list.

new!(attrs)

@spec new!(map() | keyword()) :: t()

Like new/1 but raises ArgumentError on invalid input.