class Kube::Config

Included Modules

Defined in:

kube/config.cr
kube/config/cluster.cr
kube/config/context.cr
kube/config/user.cr
kube/config/var.cr

Constructors

Class Method Summary

Instance Method Summary

Instance methods inherited from module Kube::Config::Var

to_h to_h

Constructor Detail

def self.new(clusters : Array(Kube::Config::Cluster), contexts : Array(Kube::Config::Context), current_context : Nil | String, preferences : Hash(String, String) = Hash(String, String).new, users : Array(Kube::Config::User) = Array(User).new, api_version : String = "v1", kind : String = "Config") #

[View source]
def self.new(ctx : YAML::ParseContext, node : YAML::Nodes::Node) #

def self.new(pull : JSON::PullParser) #

def self.new #

[View source]

Class Method Detail

def self.autoconfig #

Attempts to create a Kube::Config automatically using environment variables, or existing configuration files.

Look-up order:

  • KUBE_TOKEN, KUBE_CA, KUBE_SERVER environment variables
  • KUBECONFIG environment variable
  • $HOME/.kube/config file

Will raise when no means of configuration is available


[View source]
def self.build(server : String, ca : String, auth_token : String, cluster_name : String = "kubernetes", user : String = "k8s-client", context : String = "k8s-client", **options) #

Build a minimal configuration from at least a server address, server certificate authority data and an access token.


[View source]
def self.defaults #

[View source]
def self.from_hash(data) #

[View source]
def self.from_kubeconfig_env(kubeconfig = nil) : Kube::Config #

Loads configuration files listed in KUBE_CONFIG environment variable and merge using the configuration merge rules, @see K8s::Config.merge


[View source]
def self.load_file(path : String) : Kube::Config #

Loads a configuration from a YAML file


[View source]

Instance Method Detail

def api_version : String #

[View source]
def api_version=(api_version : String) #

[View source]
def cluster(name : String | Nil = nil) : Cluster #

Returns the cluster with the given name or the cluster of the current context


[View source]
def clusters : Array(Cluster) #

[View source]
def clusters=(clusters : Array(Cluster)) #

[View source]
def context(name : String | Nil = nil) : Context #

Returns the context with the given name or the current context


[View source]
def contexts : Array(Context) #

[View source]
def contexts=(contexts : Array(Context)) #

[View source]
def current_context : String | Nil #

[View source]
def current_context=(current_context : String | Nil) #

[View source]
def kind : String #

[View source]
def kind=(kind : String) #

[View source]
def merge(other : Kube::Config) : Kube::Config #

Merges configuration according to the rules specified in https://kubernetes.io/docs/concepts/configuration/organize-cluster-access-kubeconfig/#merging-kubeconfig-files


[View source]
def merge!(other : Kube::Config) : Kube::Config #

[View source]
def preferences : Hash(String, String) #

[View source]
def preferences=(preferences : Hash(String, String)) #

[View source]
def user(name : String | Nil = nil) : User #

Returns the user with the given name or the user of the current context


[View source]
def users : Array(User) #

[View source]
def users=(users : Array(User)) #

[View source]