Class: Kbt::Container

Inherits:
Object
  • Object
show all
Defined in:
lib/kbt/container.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(args = {}) ⇒ Container

Returns a new instance of Container.



4
5
6
7
8
9
10
# File 'lib/kbt/container.rb', line 4

def initialize(args = {})
  @template = args.fetch(:template)
  @name = args.fetch(:name)
  @image = args.fetch(:image)
  @command = args.fetch(:command)
  @env = args.fetch(:env)
end

Instance Attribute Details

#commandObject (readonly)

Returns the value of attribute command.



3
4
5
# File 'lib/kbt/container.rb', line 3

def command
  @command
end

#envObject (readonly)

Returns the value of attribute env.



3
4
5
# File 'lib/kbt/container.rb', line 3

def env
  @env
end

#imageObject (readonly)

Returns the value of attribute image.



3
4
5
# File 'lib/kbt/container.rb', line 3

def image
  @image
end

#nameObject (readonly)

Returns the value of attribute name.



3
4
5
# File 'lib/kbt/container.rb', line 3

def name
  @name
end

#templateObject (readonly)

Returns the value of attribute template.



3
4
5
# File 'lib/kbt/container.rb', line 3

def template
  @template
end

Instance Method Details

#callObject



29
30
# File 'lib/kbt/container.rb', line 29

def call
end

#overridesObject



19
20
21
22
23
24
25
26
27
# File 'lib/kbt/container.rb', line 19

def overrides
  {
    "name"=> name,
    "image"=> image,
    "command" => command,
    "env" => env.to_h
  }
  # TODO add volumeMounts
end

#to_hObject



12
13
14
15
16
17
# File 'lib/kbt/container.rb', line 12

def to_h
  Fusu::Hash.deep_merge(
    template.value,
    overrides
  )
end