Class: OodCore::Job::Adapters::Kubernetes::Resources::Container
- Inherits:
-
Object
- Object
- OodCore::Job::Adapters::Kubernetes::Resources::Container
- Defined in:
- lib/ood_core/job/adapters/kubernetes/resources.rb
Overview
Utility class for kuberenetes container object.
Instance Attribute Summary collapse
-
#command ⇒ Object
Returns the value of attribute command.
-
#cpu_limit ⇒ Object
Returns the value of attribute cpu_limit.
-
#cpu_request ⇒ Object
Returns the value of attribute cpu_request.
-
#env ⇒ Object
Returns the value of attribute env.
-
#image ⇒ Object
Returns the value of attribute image.
-
#image_pull_policy ⇒ Object
Returns the value of attribute image_pull_policy.
-
#image_pull_secret ⇒ Object
Returns the value of attribute image_pull_secret.
-
#labels ⇒ Object
Returns the value of attribute labels.
-
#memory_limit ⇒ Object
Returns the value of attribute memory_limit.
-
#memory_request ⇒ Object
Returns the value of attribute memory_request.
-
#name ⇒ Object
Returns the value of attribute name.
-
#port ⇒ Object
Returns the value of attribute port.
-
#restart_policy ⇒ Object
Returns the value of attribute restart_policy.
-
#startup_probe ⇒ Object
Returns the value of attribute startup_probe.
-
#supplemental_groups ⇒ Object
Returns the value of attribute supplemental_groups.
-
#working_dir ⇒ Object
Returns the value of attribute working_dir.
Instance Method Summary collapse
- #==(other) ⇒ Object
-
#initialize(name, image, command: [], port: nil, env: {}, memory_limit: nil, memory_request: nil, cpu_limit: nil, cpu_request: nil, working_dir: "", restart_policy: "Never", image_pull_policy: nil, image_pull_secret: nil, supplemental_groups: [], startup_probe: {}, labels: {}) ⇒ Container
constructor
A new instance of Container.
Constructor Details
#initialize(name, image, command: [], port: nil, env: {}, memory_limit: nil, memory_request: nil, cpu_limit: nil, cpu_request: nil, working_dir: "", restart_policy: "Never", image_pull_policy: nil, image_pull_secret: nil, supplemental_groups: [], startup_probe: {}, labels: {}) ⇒ Container
Returns a new instance of Container.
66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 |
# File 'lib/ood_core/job/adapters/kubernetes/resources.rb', line 66 def initialize( name, image, command: [], port: nil, env: {}, memory_limit: nil, memory_request: nil, cpu_limit: nil, cpu_request: nil, working_dir: "", restart_policy: "Never", image_pull_policy: nil, image_pull_secret: nil, supplemental_groups: [], startup_probe: {}, labels: {} ) raise ArgumentError, "containers need valid names and images" unless name && image @name = name @image = image @command = command.nil? ? [] : command @port = port&.to_i @env = env.nil? ? {} : env @memory_limit = memory_limit.nil? ? "4Gi" : memory_limit @memory_request = memory_request.nil? ? "4Gi" : memory_request @cpu_limit = cpu_limit.nil? ? "1" : cpu_limit @cpu_request = cpu_request.nil? ? "1" : cpu_request @working_dir = working_dir.nil? ? "" : working_dir @restart_policy = restart_policy.nil? ? "Never" : restart_policy @image_pull_policy = image_pull_policy.nil? ? "IfNotPresent" : image_pull_policy @image_pull_secret = image_pull_secret @supplemental_groups = supplemental_groups.nil? ? [] : supplemental_groups @startup_probe = TCPProbe.new(@port, startup_probe) @labels = labels.nil? ? {} : labels end |
Instance Attribute Details
#command ⇒ Object
Returns the value of attribute command.
61 62 63 |
# File 'lib/ood_core/job/adapters/kubernetes/resources.rb', line 61 def command @command end |
#cpu_limit ⇒ Object
Returns the value of attribute cpu_limit.
61 62 63 |
# File 'lib/ood_core/job/adapters/kubernetes/resources.rb', line 61 def cpu_limit @cpu_limit end |
#cpu_request ⇒ Object
Returns the value of attribute cpu_request.
61 62 63 |
# File 'lib/ood_core/job/adapters/kubernetes/resources.rb', line 61 def cpu_request @cpu_request end |
#env ⇒ Object
Returns the value of attribute env.
61 62 63 |
# File 'lib/ood_core/job/adapters/kubernetes/resources.rb', line 61 def env @env end |
#image ⇒ Object
Returns the value of attribute image.
61 62 63 |
# File 'lib/ood_core/job/adapters/kubernetes/resources.rb', line 61 def image @image end |
#image_pull_policy ⇒ Object
Returns the value of attribute image_pull_policy.
61 62 63 |
# File 'lib/ood_core/job/adapters/kubernetes/resources.rb', line 61 def image_pull_policy @image_pull_policy end |
#image_pull_secret ⇒ Object
Returns the value of attribute image_pull_secret.
61 62 63 |
# File 'lib/ood_core/job/adapters/kubernetes/resources.rb', line 61 def image_pull_secret @image_pull_secret end |
#labels ⇒ Object
Returns the value of attribute labels.
61 62 63 |
# File 'lib/ood_core/job/adapters/kubernetes/resources.rb', line 61 def labels @labels end |
#memory_limit ⇒ Object
Returns the value of attribute memory_limit.
61 62 63 |
# File 'lib/ood_core/job/adapters/kubernetes/resources.rb', line 61 def memory_limit @memory_limit end |
#memory_request ⇒ Object
Returns the value of attribute memory_request.
61 62 63 |
# File 'lib/ood_core/job/adapters/kubernetes/resources.rb', line 61 def memory_request @memory_request end |
#name ⇒ Object
Returns the value of attribute name.
61 62 63 |
# File 'lib/ood_core/job/adapters/kubernetes/resources.rb', line 61 def name @name end |
#port ⇒ Object
Returns the value of attribute port.
61 62 63 |
# File 'lib/ood_core/job/adapters/kubernetes/resources.rb', line 61 def port @port end |
#restart_policy ⇒ Object
Returns the value of attribute restart_policy.
61 62 63 |
# File 'lib/ood_core/job/adapters/kubernetes/resources.rb', line 61 def restart_policy @restart_policy end |
#startup_probe ⇒ Object
Returns the value of attribute startup_probe.
61 62 63 |
# File 'lib/ood_core/job/adapters/kubernetes/resources.rb', line 61 def startup_probe @startup_probe end |
#supplemental_groups ⇒ Object
Returns the value of attribute supplemental_groups.
61 62 63 |
# File 'lib/ood_core/job/adapters/kubernetes/resources.rb', line 61 def supplemental_groups @supplemental_groups end |
#working_dir ⇒ Object
Returns the value of attribute working_dir.
61 62 63 |
# File 'lib/ood_core/job/adapters/kubernetes/resources.rb', line 61 def working_dir @working_dir end |
Instance Method Details
#==(other) ⇒ Object
92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 |
# File 'lib/ood_core/job/adapters/kubernetes/resources.rb', line 92 def ==(other) name == other.name && image == other.image && command == other.command && port == other.port && env == other.env && memory_limit == other.memory_limit && memory_request == other.memory_request && cpu_limit == other.cpu_limit && cpu_request == other.cpu_request && working_dir == other.working_dir && restart_policy == other.restart_policy && image_pull_policy == other.image_pull_policy && image_pull_secret == other.image_pull_secret && supplemental_groups == other.supplemental_groups && startup_probe.to_h == other.startup_probe.to_h && labels.to_h == other.labels.to_h end |