Class: Kubec::Kubernetes::Volume
- Inherits:
-
Hash
- Object
- Hash
- Kubec::Kubernetes::Volume
- Defined in:
- lib/kubec/kubernetes/volume.rb
Overview
:nodoc:
Instance Method Summary collapse
-
#config(name, items) ⇒ Object
TODO: Check for should create a new class to handle.
- #empty(memory = false) ⇒ Object
-
#fetch(*args) ⇒ Object
TODO: Refactor this feature.
- #gce(name, type: 'ext4', ro: false) ⇒ Object
- #host_path(path, type = nil) ⇒ Object
-
#initialize(name, &block) ⇒ Volume
constructor
A new instance of Volume.
- #secret(name, items = nil) ⇒ Object
Constructor Details
#initialize(name, &block) ⇒ Volume
Returns a new instance of Volume.
7 8 9 10 |
# File 'lib/kubec/kubernetes/volume.rb', line 7 def initialize(name, &block) self[:name] = name instance_eval(&block) end |
Instance Method Details
#config(name, items) ⇒ Object
TODO: Check for should create a new class to handle
39 40 41 42 43 44 45 46 |
# File 'lib/kubec/kubernetes/volume.rb', line 39 def config(name, items) self[:configMap] = { name: name, items: items.map do |key, path| { key: key, path: path } end } end |
#empty(memory = false) ⇒ Object
17 18 19 20 21 22 23 |
# File 'lib/kubec/kubernetes/volume.rb', line 17 def empty(memory = false) self[:emptyDir] = if memory { medium: true } else {} end end |
#fetch(*args) ⇒ Object
TODO: Refactor this feature
13 14 15 |
# File 'lib/kubec/kubernetes/volume.rb', line 13 def fetch(*args) Environment.instance.fetch(*args) end |
#gce(name, type: 'ext4', ro: false) ⇒ Object
30 31 32 33 34 35 36 |
# File 'lib/kubec/kubernetes/volume.rb', line 30 def gce(name, type: 'ext4', ro: false) self[:gcePersistentDisk] = { pdName: name, fsType: type, readOnly: ro } end |
#host_path(path, type = nil) ⇒ Object
25 26 27 28 |
# File 'lib/kubec/kubernetes/volume.rb', line 25 def host_path(path, type = nil) self[:hostPath] = { path: path } self[:hostPath][:type] = type unless type.nil? end |
#secret(name, items = nil) ⇒ Object
48 49 50 51 52 53 54 55 |
# File 'lib/kubec/kubernetes/volume.rb', line 48 def secret(name, items = nil) self[:secret] = { secretName: name, items: items&.map do |key, path| { key: key, path: path } end }.reject { |_, v| v.nil? } end |