Class: Kubes::Kubectl::Fetch::Base
- Inherits:
-
Object
- Object
- Kubes::Kubectl::Fetch::Base
- Extended by:
- Memoist
- Defined in:
- lib/kubes/kubectl/fetch/base.rb
Direct Known Subclasses
Instance Method Summary collapse
- #fetch(kind) ⇒ Object
-
#initialize(options = {}) ⇒ Base
constructor
A new instance of Base.
- #namespace ⇒ Object
Methods included from Util::Sh
Methods included from Logging
Constructor Details
#initialize(options = {}) ⇒ Base
9 10 11 |
# File 'lib/kubes/kubectl/fetch/base.rb', line 9 def initialize(={}) = end |
Instance Method Details
#fetch(kind) ⇒ Object
13 14 15 16 17 |
# 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 ⇒ Object
19 20 21 22 23 24 |
# 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 |