struct

KCE::ConfigReader

Inherits Struct < Value < Object

Implements YAML parser for KUBECONFIG Structs are generated by quicktype <3

Usage example:

require "kce/configreader"

# if path is omitted, KUBECONFIG env variable will be used
# if env variable is unset, it defaults to "~/.kube/config"
reader = KCE::ConfigReader.new
config = reader.config
pp! config

# reading from alternative path
reader = KCE::ConfigReader.new("/path/to/kubeconfig")

# getting config via class method
KCE::ConfigReader.config("/path/to/kubeconfig")

Constructors

new(file : String | Nil = nil)
Source

Class methods

config(file : String | Nil = nil)

Returns config YAML parsed config object.

When file is not passed, uses value of KUBECONFIG. If KUBECONFIG is unset, defaults to $HOME/.kube/config

Raises KCE::Exceptions::NoFileAccessError if file is not accessible

Source

Instance methods

config

Parsed KUBECONFIG object

Source
file

Target KUBECONFIG used for parsing

Source

Nested types