Class: Kubec::Config::Downloader

Inherits:
Object
  • Object
show all
Defined in:
lib/kubec/config/downloader.rb

Overview

:nodoc:

Instance Method Summary collapse

Constructor Details

#initializeDownloader

Returns a new instance of Downloader.



7
8
9
10
11
12
13
# File 'lib/kubec/config/downloader.rb', line 7

def initialize
  @result = `kubectl -n #{fetch(:stage, :staging)} get configmap -o json`
  @success = $CHILD_STATUS.success?
  @items = {}

  prepare
end

Instance Method Details

#saveObject



15
16
17
18
19
20
21
22
# File 'lib/kubec/config/downloader.rb', line 15

def save
  Kubernetes.config.each do |config|
    downloaded = @items[config.name]
    config.files.each do |(key, path)|
      write path, downloaded.dig('data', key)
    end
  end
end