class Kubes::Kubectl::Fetch::Base
Public Class Methods
new(options={})
click to toggle source
# File lib/kubes/kubectl/fetch/base.rb, line 9 def initialize(options={}) @options = options end
Public Instance Methods
fetch(kind)
click to toggle source
# File lib/kubes/kubectl/fetch/base.rb, line 13 def fetch(kind) return [] unless namespace data = Kubes::Kubectl.capture("get #{kind} -o json -n #{namespace}") data['items'] || [] # Note: When fetching only 1 resource, items is not part of structure end
namespace()
click to toggle source
# File lib/kubes/kubectl/fetch/base.rb, line 19 def namespace path = ".kubes/output/shared/namespace.yaml" return unless File.exist?(path) data = Kubes::Kubectl.capture("get -f #{path} -o json") data['metadata']['name'] end