k8s v0.3.1 K8s.Cluster
Cluster configuration and API route store for K8s.Client
Link to this section Summary
Functions
Retrieve the base URL for a cluster
Retrieve a cluster's connection configuration.
List registered cluster names
Retrieve the URL for a K8s.Operation
Link to this section Functions
Link to this function
base_url(cluster)
Retrieve the base URL for a cluster
Examples
iex> conf = K8s.Conf.from_file("./test/support/kube-config.yaml")
...> K8s.Cluster.Registry.add(:test_cluster, conf)
...> K8s.Cluster.base_url(:test_cluster)
{:ok, "https://localhost:6443"}
Link to this function
conf(cluster_name)
conf(cluster_name)
conf(atom()) :: {:ok, K8s.Conf.t()} | {:error, :cluster_not_registered}
conf(atom()) :: {:ok, K8s.Conf.t()} | {:error, :cluster_not_registered}
Retrieve a cluster's connection configuration.
Example
iex> config_file = K8s.Conf.from_file("./test/support/kube-config.yaml", [user: "token-user"])
...> K8s.Cluster.Registry.add(:test_cluster, config_file)
...> {:ok, conf} = K8s.Cluster.conf(:test_cluster)
...> conf
%K8s.Conf{auth: %K8s.Conf.Auth.Token{token: "just-a-token-user-pun-intended"}, ca_cert: nil, cluster_name: "docker-for-desktop-cluster", insecure_skip_tls_verify: true, url: "https://localhost:6443",user_name: "token-user"}
Link to this function
list()
list()
list() :: [atom()]
list() :: [atom()]
List registered cluster names
Link to this function
url_for(operation, cluster)
url_for(operation, cluster)
url_for(K8s.Operation.t(), atom()) ::
{:ok, binary()} | {:error, atom(), binary()}
url_for(K8s.Operation.t(), atom()) :: {:ok, binary()} | {:error, atom(), binary()}
Retrieve the URL for a K8s.Operation
Examples
iex> conf = K8s.Conf.from_file("./test/support/kube-config.yaml")
...> K8s.Cluster.Registry.add(:test_cluster, conf)
...> operation = K8s.Operation.build(:get, "apps/v1", :deployments, [namespace: "default", name: "nginx"])
...> K8s.Cluster.url_for(operation, :test_cluster)
{:ok, "https://localhost:6443/apis/apps/v1/namespaces/default/deployments/nginx"}