class Bcome::Node::Kube::Base

Attributes

resources[R]

Public Class Methods

new(kube_wrap, config = {}) click to toggle source
# File lib/objects/node/kube/base.rb, line 9
def initialize(kube_wrap, config = {})
  @kube_wrap = kube_wrap
  @config = config
  @resources = []
end

Public Instance Methods

build() click to toggle source
# File lib/objects/node/kube/base.rb, line 23
def build
  child_node_lookup_result = run(get_child_node_command)
  parse(child_node_lookup_result)
end
get_child_config_from_line(*_params) click to toggle source
# File lib/objects/node/kube/base.rb, line 46
def get_child_config_from_line(*_params)
  raise 'should be overidden'
end
get_child_node_command() click to toggle source
# File lib/objects/node/kube/base.rb, line 42
def get_child_node_command
  raise 'should be overriden'
end
parent() click to toggle source
# File lib/objects/node/kube/base.rb, line 15
def parent
  @config[:parent]
end
parse(child_node_lookup_result) click to toggle source
# File lib/objects/node/kube/base.rb, line 28
def parse(child_node_lookup_result)
  # Get the output
  output = child_node_lookup_result.stdout
  # Remove the title & form array
  data = output.remove_lines(1).split("\n")

  structured_data = {}
  data.each do |raw_namespace_line|
    child_config = get_child_config_from_line(raw_namespace_line)
    child_config.merge!(parent: self)
    @resources << child_node_klass.new(@kube_wrap, child_config)
  end
end
run(command) click to toggle source
# File lib/objects/node/kube/base.rb, line 19
def run(command)
  @kube_wrap.run(command)
end