View Source K8s.Discovery.Driver behaviour (k8s v2.6.1)
Driver behaviour for K8s.Discovery
Summary
Types
Errors returned by adapters should return an error tuple with an atom()
describing the error or alternatively an "error" struct with more details.
Types
Callbacks
@callback resources(api_version :: String.t(), conn :: K8s.Conn.t()) :: {:ok, [map()]} | driver_error_t()
List of Kubernetes APIResourceList
s
Examples
iex> {:ok, conn} = K8s.Conn.from_file("test/support/kube-config.yaml")
...> K8s.Discovery.Driver.HTTP.resources("autoscaling/v1", conn)
{:ok, [
%{
"kind" => "DaemonSet",
"name" => "daemonsets"
},
%{
"kind" => "Deployment",
"name" => "deployments"
},
%{
"kind" => "Deployment",
"name" => "deployments/status"
}
]}
@callback resources(api_version :: String.t(), conn :: K8s.Conn.t(), opts :: Keyword.t()) :: {:ok, [map()]} | driver_error_t()
@callback versions(conn :: K8s.Conn.t()) :: {:ok, [String.t()]} | driver_error_t()
List of Kubernetes apiVersion
s
Examples
iex> {:ok, conn} = K8s.Conn.from_file("test/support/kube-config.yaml")
...> K8s.Discovery.Driver.HTTP.api(conn)
{:ok, ["v1"]}
@callback versions(conn :: K8s.Conn.t(), opts :: Keyword.t()) :: {:ok, [String.t()]} | driver_error_t()