Class: Kubec::Secret::Downloader

Inherits:
Object
  • Object
show all
Defined in:
lib/kubec/secret/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/secret/downloader.rb', line 7

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

  prepare
end

Instance Method Details

#saveObject



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

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