View Source Kubereq.Kubeconfig (kubereq v0.1.1)

This is the Pluggable.Token for the pipeline loading the Kubernetes config.

Summary

Types

t()

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_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

@spec load(pipeline :: module()) :: t()

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", relative_to_home?: true},
  Kubereq.Kubeconfig.ServiceAccount
])
@spec new!(keyword()) :: t()

Creates a new %Kubereq.Kubeconfig{} struct with the given fields

Link to this function

set_current_context(kubeconfig, current_context)

View Source
@spec set_current_context(kubeconfig :: t(), current_context :: String.t()) :: t()

Sets the current context. This function sets current_cluster and current_user in the given Kubereq.Kubeconfig.t()