View Source Bonny.Server.Reconciler behaviour (bonny v0.5.1)

Creates a stream that, when run, streams a list of resources and calls reconcile/1 on the given controller for each resource in the stream in parallel.

example

Example

reconciliation_stream = Bonny.Server.Reconciler.get_stream(controller)
Task.async(fn -> Stream.run(reconciliation_stream) end)

Link to this section Summary

Callbacks

Takes a controller that must define the following functions and returns a (prepared) stream.

Link to this section Callbacks

@callback reconcile(map()) :: :ok | {:ok, any()} | {:error, any()}

Takes a controller that must define the following functions and returns a (prepared) stream.

  • conn/0 - should return a K8s.Conn.t()
  • reconcile_operation/0 - should return a K8s.Operation.t() list operation that produces the stream of resources
  • reconcile/1 - takes a map and processes it

Link to this section Functions

Link to this function

get_stream(controller, conn, reconcile_operation, opts \\ [])

View Source
@spec get_stream(module(), K8s.Conn.t(), K8s.Operation.t(), keyword()) ::
  Enumerable.t()