Class: Kubec::Kubernetes::Secret

Inherits:
ConfigMap
  • Object
show all
Defined in:
lib/kubec/kubernetes/secret.rb

Overview

:nodoc:

Instance Attribute Summary

Attributes inherited from ConfigMap

#files, #name

Instance Method Summary collapse

Methods inherited from ConfigMap

#initialize

Constructor Details

This class inherits a constructor from Kubec::Kubernetes::ConfigMap

Instance Method Details

#fetch(*args) ⇒ Object

TODO: Refactor this feature



8
9
10
# File 'lib/kubec/kubernetes/secret.rb', line 8

def fetch(*args)
  Environment.instance.fetch(*args)
end

#file(path) ⇒ Object

TODO: Refactor



17
18
19
20
21
22
23
# File 'lib/kubec/kubernetes/secret.rb', line 17

def file(path)
  key = path.split('/').last
  @files[key] = path
  path = Utils::Path.with_stage(path) if stage_config_exist?(path)
  value = File.read(path) if File.exist?(path)
  set key, value || ''
end

#set(key, value) ⇒ Object



12
13
14
# File 'lib/kubec/kubernetes/secret.rb', line 12

def set(key, value)
  self[:data][key] = Base64.encode64(value).delete("\n")
end