Class: Porkadot::Configs::Kubelet
Instance Attribute Summary collapse
Instance Method Summary
collapse
#asset_path, #config, #logger, #method_missing, #raw, #respond_to_missing?, #secrets_path
Constructor Details
#initialize(config, name, raw) ⇒ Kubelet
Returns a new instance of Kubelet.
41
42
43
44
45
46
47
48
49
50
|
# File 'lib/porkadot/configs/kubelet.rb', line 41
def initialize config, name, raw
@config = config
@name = name
@raw = raw || ::Porkadot::Raw.new
hostname = @raw.hostname || name
con = { hostname: hostname }
gcon = config.connection.to_hash
lcon = @raw.connection ? @raw.connection.to_hash : {}
@connection = ::Porkadot::Raw.new(con.rmerge(gcon.rmerge(lcon)))
end
|
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
in the class Porkadot::ConfigUtils
Instance Attribute Details
#connection ⇒ Object
Returns the value of attribute connection.
39
40
41
|
# File 'lib/porkadot/configs/kubelet.rb', line 39
def connection
@connection
end
|
#name ⇒ Object
Returns the value of attribute name.
38
39
40
|
# File 'lib/porkadot/configs/kubelet.rb', line 38
def name
@name
end
|
Instance Method Details
#addon_path ⇒ Object
96
97
98
|
# File 'lib/porkadot/configs/kubelet.rb', line 96
def addon_path
File.join(self.target_path, 'addons')
end
|
#addon_secrets_path ⇒ Object
100
101
102
|
# File 'lib/porkadot/configs/kubelet.rb', line 100
def addon_secrets_path
File.join(self.target_secrets_path, 'addons')
end
|
#annotations ⇒ Object
69
70
71
|
# File 'lib/porkadot/configs/kubelet.rb', line 69
def annotations
return self.raw.annotations || {}
end
|
#apiserver? ⇒ Boolean
52
53
54
|
# File 'lib/porkadot/configs/kubelet.rb', line 52
def apiserver?
self.raw.labels && self.raw.labels.include?(Porkadot::K8S_MASTER_LABEL)
end
|
#bootstrap_cert_path ⇒ Object
108
109
110
|
# File 'lib/porkadot/configs/kubelet.rb', line 108
def bootstrap_cert_path
File.join(self.target_path, 'bootstrap.crt')
end
|
#bootstrap_key_path ⇒ Object
104
105
106
|
# File 'lib/porkadot/configs/kubelet.rb', line 104
def bootstrap_key_path
File.join(self.target_secrets_path, 'bootstrap.key')
end
|
#control_plane_endpoint ⇒ Object
56
57
58
|
# File 'lib/porkadot/configs/kubelet.rb', line 56
def control_plane_endpoint
(self.raw.kubernetes && self.raw.kubernetes.control_plane_endpoint) || self.config.k8s.control_plane_endpoint
end
|
#hostname ⇒ Object
84
85
86
|
# File 'lib/porkadot/configs/kubelet.rb', line 84
def hostname
self.raw.hostname || self.name
end
|
#kubelet_config ⇒ Object
73
74
75
76
77
78
79
80
81
82
|
# File 'lib/porkadot/configs/kubelet.rb', line 73
def kubelet_config
kc = self.raw.config || ::Porkadot::Raw.new
kc = kc.merge(self.config.kubernetes.kubelet.config)
kc.clusterDNS << self.config.k8s.networking.dns_ip.to_s
kc.clusterDomain = self.config.k8s.networking.dns_domain
if self.raw.taints
kc.registerWithTaints = self.raw.taints
end
return kc
end
|
#labels ⇒ Object
65
66
67
|
# File 'lib/porkadot/configs/kubelet.rb', line 65
def labels
return self.raw.labels || {}
end
|
#labels_string ⇒ Object
60
61
62
63
|
# File 'lib/porkadot/configs/kubelet.rb', line 60
def labels_string
return '' unless self.raw.labels
return self.raw.labels.map{|v| v.compact.join('=')}.join(',')
end
|
#target_path ⇒ Object
88
89
90
|
# File 'lib/porkadot/configs/kubelet.rb', line 88
def target_path
File.join(self.config.assets_dir, 'kubelet', name)
end
|
#target_secrets_path ⇒ Object
92
93
94
|
# File 'lib/porkadot/configs/kubelet.rb', line 92
def target_secrets_path
File.join(self.config.secrets_root_dir, 'kubelet', name)
end
|