View Source Datapio.Controller behaviour (Datapio OpenCore v0.1.0)

Behaviour used to implement a Kubernetes operator.

Example:

defmodule MyApp.MyOperator do
  use Datapio.Controller,
    api_version: "v1"
    kind: "Pod"

  @impl true
  def add(pod, _opts) do
    :ok
  end

  @impl true
  def modify(pod, _opts) do
    :ok
  end

  @impl true
  def delete(pod, _opts) do
    :ok
  end

  @impl true
  def reconcile(pod, _opts) do
    :ok
  end
end

Link to this section Summary

Types

Options passed to the controller's callbacks

Default options

Option passed to start_link/2

Option controlling how the Datapio.Controller should be supervised

Option controlling what Kubernetes resources are watched

Functions

Returns a specification to start this module under a supervisor.

Start a controller linked to the current process

Link to this section Types

Specs

controller_options() :: keyword()

Options passed to the controller's callbacks

Specs

module_option() ::
  watch_option() | {:schema, schema()} | {:supervisor, supervisor_options()}

Default options

Specs

module_options() :: [module_option(), ...]

Specs

Specs

Specs

start_option() :: watch_option() | {:options, controller_options()}

Option passed to start_link/2

Specs

start_options() :: [start_option(), ...]

Specs

supervisor_option() ::
  {:restart, :temporary | :transient | :permanent}
  | {:shutdown, timeout() | :brutal_kill}

Option controlling how the Datapio.Controller should be supervised

Specs

supervisor_options() :: [supervisor_option()]

Specs

watch_option() ::
  {:api_version, String.t()}
  | {:kind, String.t()}
  | {:namespace, :all | String.t()}
  | {:reconcile_delay, non_neg_integer()}

Option controlling what Kubernetes resources are watched

Link to this section Callbacks

Link to this callback

add(resource, controller_options)

View Source

Specs

add(resource(), controller_options()) :: :ok | {:error, term()}
Link to this callback

delete(resource, controller_options)

View Source

Specs

delete(resource(), controller_options()) :: :ok | {:error, term()}
Link to this callback

modify(resource, controller_options)

View Source

Specs

modify(resource(), controller_options()) :: :ok | {:error, term()}
Link to this callback

reconcile(resource, controller_options)

View Source

Specs

reconcile(resource(), controller_options()) :: :ok | {:error, term()}

Link to this section Functions

Returns a specification to start this module under a supervisor.

See Supervisor.

Link to this function

start_link(module, opts)

View Source

Specs

start_link(module(), start_options()) :: GenServer.on_start()

Start a controller linked to the current process