Class: MobyDerp::ContainerConfig

Inherits:
Object
  • Object
show all
Defined in:
lib/moby_derp/container_config.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(system_config:, pod_config:, container_name:, image:, update_image: true, command: [], entrypoint: nil, environment: {}, environment_files: {}, mounts: [], labels: {}, readonly: false, stop_signal: "SIGTERM", stop_timeout: 10, user: nil, restart: "no", limits: {}, startup_health_check: nil) ⇒ ContainerConfig

Returns a new instance of ContainerConfig.



14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
# File 'lib/moby_derp/container_config.rb', line 14

def initialize(system_config:,
               pod_config:,
               container_name:,
               image:,
               update_image: true,
               command: [],
               entrypoint: nil,
               environment: {},
               environment_files: {},
               mounts: [],
               labels: {},
               readonly: false,
               stop_signal: "SIGTERM",
               stop_timeout: 10,
               user: nil,
               restart: "no",
               limits: {},
               startup_health_check: nil
              )
	@system_config, @pod_config, @name, @image = system_config, pod_config, "#{pod_config.name}.#{container_name}", image

	@update_image, @command, @entrypoint, @environment, @environment_files, @mounts, @labels = update_image, command, entrypoint, environment, environment_files, mounts, labels
	@readonly, @stop_signal, @stop_timeout, @user, @restart = readonly, stop_signal, stop_timeout, user, restart
	@limits, @startup_health_check = limits, startup_health_check

	validate_image
	validate_update_image
	validate_command
	validate_entrypoint
	validate_environment
	validate_environment_files
	validate_mounts
	validate_labels
	validate_readonly
	validate_stop_signal
	validate_stop_timeout
	validate_user
	validate_restart
	validate_limits
	validate_startup_health_check
end

Instance Attribute Details

#commandObject (readonly)

Returns the value of attribute command.



10
11
12
# File 'lib/moby_derp/container_config.rb', line 10

def command
  @command
end

#entrypointObject (readonly)

Returns the value of attribute entrypoint.



10
11
12
# File 'lib/moby_derp/container_config.rb', line 10

def entrypoint
  @entrypoint
end

#environmentObject (readonly)

Returns the value of attribute environment.



10
11
12
# File 'lib/moby_derp/container_config.rb', line 10

def environment
  @environment
end

#environment_filesObject (readonly)

Returns the value of attribute environment_files.



10
11
12
# File 'lib/moby_derp/container_config.rb', line 10

def environment_files
  @environment_files
end

#imageObject (readonly)

Returns the value of attribute image.



10
11
12
# File 'lib/moby_derp/container_config.rb', line 10

def image
  @image
end

#labelsObject (readonly)

Returns the value of attribute labels.



10
11
12
# File 'lib/moby_derp/container_config.rb', line 10

def labels
  @labels
end

#limitsObject (readonly)

Returns the value of attribute limits.



10
11
12
# File 'lib/moby_derp/container_config.rb', line 10

def limits
  @limits
end

#mountsObject (readonly)

Returns the value of attribute mounts.



10
11
12
# File 'lib/moby_derp/container_config.rb', line 10

def mounts
  @mounts
end

#nameObject (readonly)

Returns the value of attribute name.



10
11
12
# File 'lib/moby_derp/container_config.rb', line 10

def name
  @name
end

#readonlyObject (readonly)

Returns the value of attribute readonly.



10
11
12
# File 'lib/moby_derp/container_config.rb', line 10

def readonly
  @readonly
end

#restartObject (readonly)

Returns the value of attribute restart.



10
11
12
# File 'lib/moby_derp/container_config.rb', line 10

def restart
  @restart
end

#startup_health_checkObject (readonly)

Returns the value of attribute startup_health_check.



10
11
12
# File 'lib/moby_derp/container_config.rb', line 10

def startup_health_check
  @startup_health_check
end

#stop_signalObject (readonly)

Returns the value of attribute stop_signal.



10
11
12
# File 'lib/moby_derp/container_config.rb', line 10

def stop_signal
  @stop_signal
end

#stop_timeoutObject (readonly)

Returns the value of attribute stop_timeout.



10
11
12
# File 'lib/moby_derp/container_config.rb', line 10

def stop_timeout
  @stop_timeout
end

#update_imageObject (readonly)

Returns the value of attribute update_image.



10
11
12
# File 'lib/moby_derp/container_config.rb', line 10

def update_image
  @update_image
end

#userObject (readonly)

Returns the value of attribute user.



10
11
12
# File 'lib/moby_derp/container_config.rb', line 10

def user
  @user
end