Class: Porkadot::Config
- Inherits:
-
Object
- Object
- Porkadot::Config
- Defined in:
- lib/porkadot/config.rb
Instance Attribute Summary collapse
-
#logger ⇒ Object
readonly
Returns the value of attribute logger.
-
#raw ⇒ Object
readonly
Returns the value of attribute raw.
Instance Method Summary collapse
- #addons ⇒ Object
- #assets_dir ⇒ Object
- #bootstrap ⇒ Object
- #certs ⇒ Object
- #connection ⇒ Object
- #etcd ⇒ Object
- #etcd_nodes ⇒ Object
-
#initialize(path) ⇒ Config
constructor
A new instance of Config.
- #kubelet_default ⇒ Object
- #kubernetes ⇒ Object (also: #k8s)
- #lb ⇒ Object
- #nodes ⇒ Object
- #secrets_root_dir ⇒ Object
Constructor Details
#initialize(path) ⇒ Config
Returns a new instance of Config.
14 15 16 17 18 19 20 21 22 23 |
# File 'lib/porkadot/config.rb', line 14 def initialize path default_config = {} open(File.(File.join(Porkadot::ROOT, 'porkadot', 'default.yaml'))) do |io| default_config = YAML::load(io) end open(File.(path)) do |io| @raw = ::Porkadot::Raw.new(default_config.rmerge(YAML.load(io))) end @logger = Logger.new(STDOUT) end |
Instance Attribute Details
#logger ⇒ Object (readonly)
Returns the value of attribute logger.
12 13 14 |
# File 'lib/porkadot/config.rb', line 12 def logger @logger end |
#raw ⇒ Object (readonly)
Returns the value of attribute raw.
11 12 13 |
# File 'lib/porkadot/config.rb', line 11 def raw @raw end |
Instance Method Details
#addons ⇒ Object
34 35 36 |
# File 'lib/porkadot/config.rb', line 34 def addons @addons ||= Porkadot::Configs::Addons.new(self) end |
#assets_dir ⇒ Object
84 85 86 |
# File 'lib/porkadot/config.rb', line 84 def assets_dir File.(raw.local.assets_dir) end |
#bootstrap ⇒ Object
43 44 45 46 |
# File 'lib/porkadot/config.rb', line 43 def bootstrap @bootstrap ||= Porkadot::Configs::Bootstrap.new(self) return @bootstrap end |
#certs ⇒ Object
25 26 27 28 |
# File 'lib/porkadot/config.rb', line 25 def certs @certs ||= Porkadot::Configs::Certs.new(self) return @certs end |
#connection ⇒ Object
30 31 32 |
# File 'lib/porkadot/config.rb', line 30 def connection self.raw.connection end |
#etcd ⇒ Object
54 55 56 57 |
# File 'lib/porkadot/config.rb', line 54 def etcd @etcd ||= Porkadot::Configs::Etcd.new(self) return @etcd end |
#etcd_nodes ⇒ Object
73 74 75 76 77 78 79 80 81 82 |
# File 'lib/porkadot/config.rb', line 73 def etcd_nodes @etcd_nodes ||= {}.tap do |nodes| self.raw.nodes.each do |k, v| if v && v.labels && v.labels.to_hash.keys.include?(Porkadot::ETCD_MEMBER_LABEL) nodes[k] = Porkadot::Configs::EtcdNode.new(self, k, v) end end end return @etcd_nodes end |
#kubelet_default ⇒ Object
59 60 61 62 |
# File 'lib/porkadot/config.rb', line 59 def kubelet_default @kubelet_default ||= Porkadot::Configs::KubeletDefault.new(self) return @kubelet_default end |
#kubernetes ⇒ Object Also known as: k8s
48 49 50 51 |
# File 'lib/porkadot/config.rb', line 48 def kubernetes @kubernetes ||= Porkadot::Configs::Kubernetes.new(self) return @kubernetes end |
#lb ⇒ Object
38 39 40 41 |
# File 'lib/porkadot/config.rb', line 38 def lb @lb ||= Porkadot::Configs::Lb.new(self) return @lb end |
#nodes ⇒ Object
64 65 66 67 68 69 70 71 |
# File 'lib/porkadot/config.rb', line 64 def nodes @nodes ||= {}.tap do |nodes| self.raw.nodes.each do |k, v| nodes[k] = Porkadot::Configs::Kubelet.new(self, k, v) end end return @nodes end |
#secrets_root_dir ⇒ Object
88 89 90 |
# File 'lib/porkadot/config.rb', line 88 def secrets_root_dir File.join(self.assets_dir, 'secrets') end |