Class: Porkadot::Configs::Kubernetes

Inherits:
Object
  • Object
show all
Includes:
Porkadot::ConfigUtils
Defined in:
lib/porkadot/configs/kubernetes.rb

Defined Under Namespace

Modules: Component Classes: Apiserver, ControllerManager, Networking, Proxy, Scheduler

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Porkadot::ConfigUtils

#asset_path, #config, #logger, #method_missing, #raw, #respond_to_missing?, #secrets_path

Constructor Details

#initialize(config) ⇒ Kubernetes

Returns a new instance of Kubernetes.



10
11
12
13
14
15
16
17
18
19
# File 'lib/porkadot/configs/kubernetes.rb', line 10

def initialize config
  @config = config
  @raw = config.raw.kubernetes

  @networking = Networking.new(config)
  @proxy = Proxy.new(config)
  @apiserver = Apiserver.new(config)
  @controller_manager = ControllerManager.new(config)
  @scheduler = Scheduler.new(config)
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Porkadot::ConfigUtils

Instance Attribute Details

#apiserverObject (readonly)

Returns the value of attribute apiserver.



6
7
8
# File 'lib/porkadot/configs/kubernetes.rb', line 6

def apiserver
  @apiserver
end

#controller_managerObject (readonly)

Returns the value of attribute controller_manager.



7
8
9
# File 'lib/porkadot/configs/kubernetes.rb', line 7

def controller_manager
  @controller_manager
end

#networkingObject (readonly)

Returns the value of attribute networking.



4
5
6
# File 'lib/porkadot/configs/kubernetes.rb', line 4

def networking
  @networking
end

#proxyObject (readonly)

Returns the value of attribute proxy.



5
6
7
# File 'lib/porkadot/configs/kubernetes.rb', line 5

def proxy
  @proxy
end

#schedulerObject (readonly)

Returns the value of attribute scheduler.



8
9
10
# File 'lib/porkadot/configs/kubernetes.rb', line 8

def scheduler
  @scheduler
end

Instance Method Details

#cluster_nameObject



21
22
23
# File 'lib/porkadot/configs/kubernetes.rb', line 21

def cluster_name
  self.raw.cluster_name || 'porkadot'
end

#control_plane_endpoint_host_and_portObject



37
38
39
40
41
42
# File 'lib/porkadot/configs/kubernetes.rb', line 37

def control_plane_endpoint_host_and_port
  endpoint = self.config.k8s.control_plane_endpoint
  raise "kubernetes.control_plane_endpoint should not be nil" unless endpoint
  index = endpoint.rindex(':')
  return [endpoint[0, index], endpoint[index+1, 6]]
end

#manifests_pathObject



33
34
35
# File 'lib/porkadot/configs/kubernetes.rb', line 33

def manifests_path
  File.join(self.target_path, 'manifests')
end

#target_pathObject



25
26
27
# File 'lib/porkadot/configs/kubernetes.rb', line 25

def target_path
  File.join(self.config.assets_dir, 'kubernetes')
end

#target_secrets_pathObject



29
30
31
# File 'lib/porkadot/configs/kubernetes.rb', line 29

def target_secrets_path
  File.join(self.config.secrets_root_dir, 'kubernetes')
end