View Source Kubereq.Kubeconfig (kubereq v0.3.1)
This is the Pluggable.Token
for the pipeline loading the Kubernetes config.
The Kubeconfig represents the configuration to establish a connection to
the Kubernetes cluster. It contains informations like endpoint, certificates,
user authentication details etc.
In most cases you can just rely on Kubereq.Kubeconfig.Default
to load
the Kubeconfig from well-known places.
Sometimes you only want to allow to load the Kubeconfig from a specific
YAML file or rely on an ENV variable pointing to that file. Check out
the Kubereq.Kubeconfig.*
modules.
You can also chain these modules to build your own Kubeconfig loader pipeline.
defmodule MyKubeconfLoader do
use Pluggable.StepBuilder
step Kubereq.Kubeconfig.ENV
step Kubereq.Kubeconfig.File, path: "/path/to/kubeconfig.yaml"
end
Summary
Types
The %Kubereq.Kubeconfig{}
struct holds information required to connect to
Kubernetes clusters
Functions
Loads the Kubernetes config by running the given pipeline
. Returns the
resulting %Kubereq.Kubeconfig{}
.
Creates a new %Kubereq.Kubeconfig{}
struct with the given fields
Sets the current context. This function sets current_cluster
and
current_user
in the given Kubereq.Kubeconfig.t()
Types
@type t() :: %Kubereq.Kubeconfig{ assigns: map(), clusters: [map()], contexts: [map()], current_cluster: map(), current_context: String.t(), current_namespace: String.t() | nil, current_user: map(), halted: boolean(), users: [map()] }
The %Kubereq.Kubeconfig{}
struct holds information required to connect to
Kubernetes clusters
For descriptions of the fields, refer to the kubeconfig.v1 documentation.
Functions
Loads the Kubernetes config by running the given pipeline
. Returns the
resulting %Kubereq.Kubeconfig{}
.
pipeline
can be passed in the form of {pipeline_module, opts}
tuples,
a single pipeline_module
or a list of either.
Example
Single pipeline module without opts passed as module:
Kubereq.Kubeconfig.load(Kubereq.Kubeconfig.Default)
Single pipeline module with opts:
Kubereq.Kubeconfig.load({Kubereq.Kubeconfig.File, path: "/path/to/kubeconfig"})
List of either:
Kubereq.Kubeconfig.load([
Kubereq.Kubeconfig.ENV,
{Kubereq.Kubeconfig.File, path: "~/.kube/config"},
Kubereq.Kubeconfig.ServiceAccount
])
Creates a new %Kubereq.Kubeconfig{}
struct with the given fields
Sets the current context. This function sets current_cluster
and
current_user
in the given Kubereq.Kubeconfig.t()