Class: Rubernetes::Auth::KubeConfig
- Inherits:
-
Object
- Object
- Rubernetes::Auth::KubeConfig
- Defined in:
- lib/rubernetes/auth/kube_config.rb
Overview
This class is used to read and parse a KUBECONFIG file. It will try to read the KUBECONFIG from ENV first, otherwise it will fallback to ~/.kube/config. It extracts the kube API endpoint and authentication details.
Constant Summary collapse
- KUBECONFIG_DEFAULT_PATH =
"#{Dir.home}/.kube/config"
Instance Method Summary collapse
- #api_endpoint ⇒ Object
- #auth_options ⇒ Object
-
#initialize ⇒ KubeConfig
constructor
A new instance of KubeConfig.
- #ssl_options ⇒ Object
Constructor Details
#initialize ⇒ KubeConfig
Returns a new instance of KubeConfig.
11 12 13 14 15 |
# File 'lib/rubernetes/auth/kube_config.rb', line 11 def initialize config_path = ENV.fetch('KUBECONFIG', KUBECONFIG_DEFAULT_PATH) config = Kubeclient::Config.read(config_path) @context = config.context end |
Instance Method Details
#api_endpoint ⇒ Object
17 18 19 |
# File 'lib/rubernetes/auth/kube_config.rb', line 17 def api_endpoint @context.api_endpoint end |
#auth_options ⇒ Object
25 26 27 |
# File 'lib/rubernetes/auth/kube_config.rb', line 25 def @context. end |
#ssl_options ⇒ Object
21 22 23 |
# File 'lib/rubernetes/auth/kube_config.rb', line 21 def @context. end |