Module: Dapp::Kube::Dapp::Command::ValueGet

Included in:
Dapp
Defined in:
lib/dapp/kube/dapp/command/value_get.rb

Instance Method Summary collapse

Instance Method Details

#kube_value_get(value_key) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/dapp/kube/dapp/command/value_get.rb', line 6

def kube_value_get(value_key)
  service_values = Helm::Values.service_values_hash(
    self, option_repo, kube_namespace, option_tags.first,
    without_registry: self.options[:without_registry],
    disable_warnings: true
  )

  res = service_values
  value_key.split(".").each do |value_key_part|
    if res.is_a?(Hash) && res.key?(value_key_part)
      res = res[value_key_part]
    else
      exit(1)
    end
  end

  if res.is_a? Hash
    puts YAML.dump(res)
  else
    puts JSON.dump(res)
  end
end