Class: Porkadot::Configs::Kubernetes::Proxy

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

Constant Summary

Constants included from Component

Component::RECOMMENDED_LABEL_PREFIX

Instance Method Summary collapse

Methods included from Component

#args, #instance_labels, #labels, #log_level

Methods included from Porkadot::ConfigUtils

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

Constructor Details

#initialize(config) ⇒ Proxy

Returns a new instance of Proxy.



207
208
209
210
# File 'lib/porkadot/configs/kubernetes.rb', line 207

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

Dynamic Method Handling

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

Instance Method Details

#bootstrap_argsObject



224
225
226
227
228
# File 'lib/porkadot/configs/kubernetes.rb', line 224

def bootstrap_args
  return %W(
    --config=/etc/kubernetes/bootstrap/kube-proxy-bootstrap.yaml
  ).map {|i| i.split('=', 2)}.to_h
end

#component_nameObject



220
221
222
# File 'lib/porkadot/configs/kubernetes.rb', line 220

def component_name
  'kube-proxy'
end

#default_argsObject



230
231
232
233
234
235
# File 'lib/porkadot/configs/kubernetes.rb', line 230

def default_args
  return %W(
    --config=/var/lib/kube-proxy/config.conf
    --hostname-override=$(NODE_NAME)
  ).map {|i| i.split('=', 2)}.to_h
end

#proxy_config(kubeconfig = nil) ⇒ Object



212
213
214
215
216
217
218
# File 'lib/porkadot/configs/kubernetes.rb', line 212

def proxy_config kubeconfig=nil
  self.raw.config['clusterCIDR'] = config.k8s.networking.pod_subnet
  if kubeconfig
    self.raw.config['clientConnection']['kubeconfig'] = kubeconfig
  end
  self.raw.config.to_hash.to_yaml
end