View Source Bonny.Server.Watcher (bonny v1.4.0)
Creates the stream for watching resources in kubernetes and prepares its processing.
Watching a resource in kubernetes results in a stream of add/modify/delete events.
This module uses K8s.Client.stream/3
to create such a stream and maps
events to a controller's event handler. It is then up to the caller to run the
resulting stream.
Example
watch_stream = Bonny.Server.Watcher.get_stream(controller)
Task.async(fn -> Stream.run(watch_stream) end)
Summary
Types
@type action() :: :add | :modify | :delete
@type watch_event() :: {action(), Bonny.Resource.t()}
Functions
@spec get_raw_stream(K8s.Conn.t(), K8s.Operation.t()) :: Enumerable.t(watch_event())
@spec get_stream(module(), K8s.Conn.t(), K8s.Operation.t()) :: Enumerable.t(Bonny.Resource.t())