Class: Kubeclient::Client
- Inherits:
-
Object
- Object
- Kubeclient::Client
- Includes:
- ClientMixin
- Defined in:
- lib/kubeclient.rb
Overview
Kubernetes Client
Constant Summary collapse
- ENTITY_TYPES =
Dynamically creating classes definitions (class Pod, class Service, etc.), The classes are extending RecursiveOpenStruct. This cancels the need to define the classes manually on every new entity addition, and especially since currently the class body is empty
%w(Pod Service ReplicationController Node Event Endpoint Namespace Secret ResourceQuota LimitRange PersistentVolume PersistentVolumeClaim ComponentStatus ServiceAccount).map do |et| clazz = Class.new(RecursiveOpenStruct) do def initialize(hash = nil, args = {}) args.merge!(recurse_over_arrays: true) super(hash, args) end end [Kubeclient.const_set(et, clazz), et] end
Instance Attribute Summary
Attributes included from ClientMixin
#api_endpoint, #auth_options, #headers, #ssl_options
Instance Method Summary collapse
- #all_entities ⇒ Object
-
#initialize(uri, version = 'v1', ssl_options: { client_cert: nil, client_key: nil, ca_file: nil, cert_store: nil, verify_ssl: OpenSSL::SSL::VERIFY_PEER }, auth_options: { username: nil, password: nil, bearer_token: nil, bearer_token_file: nil }, socket_options: { socket_class: nil, ssl_socket_class: nil }) ⇒ Client
constructor
A new instance of Client.
Methods included from ClientMixin
#api, #api_valid?, #build_namespace_prefix, #create_entity, #create_rest_client, define_entity_methods, #delete_entity, #get_entities, #get_entity, #get_pod_log, #handle_exception, #handle_uri, #initialize_client, #new_entity, pluralize_entity, #proxy_url, #resource_name, #rest_client, #retrieve_all_entities, #update_entity, #watch_entities, #watch_pod_log
Constructor Details
#initialize(uri, version = 'v1', ssl_options: { client_cert: nil, client_key: nil, ca_file: nil, cert_store: nil, verify_ssl: OpenSSL::SSL::VERIFY_PEER }, auth_options: { username: nil, password: nil, bearer_token: nil, bearer_token_file: nil }, socket_options: { socket_class: nil, ssl_socket_class: nil }) ⇒ Client
Returns a new instance of Client.
34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 |
# File 'lib/kubeclient.rb', line 34 def initialize(uri, version = 'v1', ssl_options: { client_cert: nil, client_key: nil, ca_file: nil, cert_store: nil, verify_ssl: OpenSSL::SSL::VERIFY_PEER }, auth_options: { username: nil, password: nil, bearer_token: nil, bearer_token_file: nil }, socket_options: { socket_class: nil, ssl_socket_class: nil } ) initialize_client(uri, '/api', version, ssl_options: , auth_options: , socket_options: ) end |
Instance Method Details
#all_entities ⇒ Object
58 59 60 |
# File 'lib/kubeclient.rb', line 58 def all_entities retrieve_all_entities(ENTITY_TYPES) end |