View Source K8s.Client.Runner.Stream.Watch (k8s v2.6.1)
Watches a K8s.Client.list/3
operation and returns an Elixir Stream
of events.
Summary
Functions
Watches resources and returns an Elixir Stream of events emmitted by kubernetes.
Types
@type t() :: %K8s.Client.Runner.Stream.Watch{ conn: K8s.Conn.t(), http_opts: keyword(), operation: K8s.Operation.t(), remainder: binary(), resource_version: binary() }
Functions
@spec stream(K8s.Conn.t(), K8s.Operation.t(), keyword()) :: {:ok, Enumerable.t()} | K8s.Client.Provider.error_t()
Watches resources and returns an Elixir Stream of events emmitted by kubernetes.
Example
iex> {:ok,conn} = K8s.Conn.from_file("~/.kube/config", [context: "docker-desktop"])
...> op = K8s.Client.list("v1", "Namespace")
...> K8s.Client.Runner.Watch.Stream.stream(conn, op, []) |> Stream.map(&IO.inspect/1) |> Stream.run()