Module: Kubetailrb::Reader::WithK8sClient
- Included in:
- K8sPodReader, K8sPodsReader
- Defined in:
- lib/kubetailrb/reader/with_k8s_client.rb
Overview
Add behavior to get a k8s client by using composition. NOTE: Is it the idiomatic way? Or shall I use a factory? Or is there a better way?
Instance Method Summary collapse
Instance Method Details
#create_k8s_client ⇒ Object
15 16 17 18 19 20 21 22 23 24 |
# File 'lib/kubetailrb/reader/with_k8s_client.rb', line 15 def create_k8s_client config = Kubeclient::Config.read(ENV['KUBECONFIG'] || "#{ENV["HOME"]}/.kube/config") context = config.context Kubeclient::Client.new( context.api_endpoint, 'v1', ssl_options: context., auth_options: context. ) end |
#k8s_client ⇒ Object
11 12 13 |
# File 'lib/kubetailrb/reader/with_k8s_client.rb', line 11 def k8s_client @k8s_client ||= create_k8s_client end |