module

KCE

KUBECONFIG Content Extractor.

KCE generates fully usable KUBECONFIG for kubecontext

Usage examples:

require "kce"

# using KCE instance methods
kce = KCE.new("my-context", "/path/to/kubeconfig")
puts kce.kubeconfig     # => path to selected KUBECONFIG file
puts kce.kubecontext    # => selected kubecontext ("my-context")
puts kce.config         # => "my-context" config as Object (from YAML)
puts kce.config.to_yaml # => "my-context" config as String (from YAML)

# using KCE class methods
config = KCE.config("my-context", "/path/to/kubeconfig")
puts config         # => "my-context" config as Object (from YAML)
puts config.to_yaml # => "my-context" config as String (from YAML)

# using KCE::ConfigReader instance methods
reader = KCE::ConfigReader.new("/path/to/kubeconfig")
reader.config         # => original KUBECONFIG as Object (from YAML)
reader.config.to_yaml # => original KUBECONFIG as String (from YAML)

# using KCE::ConfigReader class methods
kubeconfig = KCE::ConfigReader.config("/path/to/kubeconfig")

Constructors

new(kubecontext : String, kubeconfig : String | Nil = nil)

Returns Extractor object for selected context

Source

Class methods

config(kubecontext : String, kubeconfig : String | Nil = nil)

Returns KUBECONFIG object for selected context

Source

Nested types