Class: Rubernetes::KubeClient
- Inherits:
-
Object
- Object
- Rubernetes::KubeClient
- Defined in:
- lib/rubernetes/kube_client.rb
Overview
A wrapper class around original Kubeclient github.com/abonas/kubeclient. It will automatically create a Kubeclient from a detected ‘serviceaccount` or `KUBECONFIG`
Constant Summary collapse
- KUBE_CLIENT_CLASS =
::Kubeclient::Client
Instance Method Summary collapse
-
#initialize(crd_group, crd_version) ⇒ KubeClient
constructor
A new instance of KubeClient.
- #method_missing(method, *args) ⇒ Object
- #respond_to_missing?(_method_name, _include_private = false) ⇒ Boolean
Constructor Details
#initialize(crd_group, crd_version) ⇒ KubeClient
Returns a new instance of KubeClient.
13 14 15 16 |
# File 'lib/rubernetes/kube_client.rb', line 13 def initialize(crd_group, crd_version) @crd_group = crd_group @crd_version = crd_version end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method, *args) ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/rubernetes/kube_client.rb', line 18 def method_missing(method, *args) auth_source = Auth::Source.new @client ||= KUBE_CLIENT_CLASS.new( "#{auth_source.api_endpoint}/apis/#{@crd_group}", @crd_version, ssl_options: auth_source., auth_options: auth_source. ) return @client.send(method, *args) if @client.respond_to?(method) super end |
Instance Method Details
#respond_to_missing?(_method_name, _include_private = false) ⇒ Boolean
33 34 35 |
# File 'lib/rubernetes/kube_client.rb', line 33 def respond_to_missing?(_method_name, _include_private = false) super end |