Class: Metatron::Templates::Job
- Inherits:
-
Metatron::Template
- Object
- Metatron::Template
- Metatron::Templates::Job
- Defined in:
- lib/metatron/templates/job.rb
Overview
Template for basic Job k8s resource
Instance Attribute Summary collapse
-
#active_deadline_seconds ⇒ Object
(also: #activeDeadlineSeconds)
Returns the value of attribute active_deadline_seconds.
-
#backoff_limit ⇒ Object
(also: #backoffLimit)
Returns the value of attribute backoff_limit.
-
#completions ⇒ Object
Returns the value of attribute completions.
-
#parallelism ⇒ Object
Returns the value of attribute parallelism.
-
#pod_failure_policy ⇒ Object
(also: #podFailurePolicy)
Returns the value of attribute pod_failure_policy.
-
#restart_policy ⇒ Object
(also: #restartPolicy)
Returns the value of attribute restart_policy.
-
#suspend ⇒ Object
Returns the value of attribute suspend.
-
#ttl_seconds_after_finished ⇒ Object
(also: #ttlSecondsAfterFinished)
Returns the value of attribute ttl_seconds_after_finished.
Attributes inherited from Metatron::Template
#additional_labels, #api_version, #base_labels, #kind, #name
Instance Method Summary collapse
-
#initialize(name) ⇒ Job
constructor
A new instance of Job.
- #render ⇒ Object
Methods included from Concerns::Namespaced
#formatted_namespace, included, #namespaced_initialize
Methods included from Concerns::PodProducer
#formatted_affinity, #formatted_containers, #formatted_image_pull_secrets, #formatted_init_containers, #formatted_node_selector, #formatted_pod_annotations, #formatted_priority_class_name, #formatted_security_context, #formatted_tolerations, #formatted_volumes, included, #pod_metadata, #pod_producer_initialize, #pod_spec, #pod_template, #volume_claim_templates
Methods included from Concerns::Annotated
#annotated_initialize, #formatted_annotations, included
Methods inherited from Metatron::Template
initializer, initializers, metatron_template_class?, nearest_metatron_ancestor
Constructor Details
#initialize(name) ⇒ Job
Returns a new instance of Job.
21 22 23 24 |
# File 'lib/metatron/templates/job.rb', line 21 def initialize(name) super @api_version = "batch/v1" end |
Instance Attribute Details
#active_deadline_seconds ⇒ Object Also known as: activeDeadlineSeconds
Returns the value of attribute active_deadline_seconds.
11 12 13 |
# File 'lib/metatron/templates/job.rb', line 11 def active_deadline_seconds @active_deadline_seconds end |
#backoff_limit ⇒ Object Also known as: backoffLimit
Returns the value of attribute backoff_limit.
11 12 13 |
# File 'lib/metatron/templates/job.rb', line 11 def backoff_limit @backoff_limit end |
#completions ⇒ Object
Returns the value of attribute completions.
11 12 13 |
# File 'lib/metatron/templates/job.rb', line 11 def completions @completions end |
#parallelism ⇒ Object
Returns the value of attribute parallelism.
11 12 13 |
# File 'lib/metatron/templates/job.rb', line 11 def parallelism @parallelism end |
#pod_failure_policy ⇒ Object Also known as: podFailurePolicy
Returns the value of attribute pod_failure_policy.
11 12 13 |
# File 'lib/metatron/templates/job.rb', line 11 def pod_failure_policy @pod_failure_policy end |
#restart_policy ⇒ Object Also known as: restartPolicy
Returns the value of attribute restart_policy.
11 12 13 |
# File 'lib/metatron/templates/job.rb', line 11 def restart_policy @restart_policy end |
#suspend ⇒ Object
Returns the value of attribute suspend.
11 12 13 |
# File 'lib/metatron/templates/job.rb', line 11 def suspend @suspend end |
#ttl_seconds_after_finished ⇒ Object Also known as: ttlSecondsAfterFinished
Returns the value of attribute ttl_seconds_after_finished.
11 12 13 |
# File 'lib/metatron/templates/job.rb', line 11 def ttl_seconds_after_finished @ttl_seconds_after_finished end |
Instance Method Details
#render ⇒ Object
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/metatron/templates/job.rb', line 26 def render { apiVersion:, kind:, metadata: { labels: base_labels.merge(additional_labels), name: }.merge(formatted_annotations).merge(formatted_namespace), spec: { suspend:, backoffLimit:, activeDeadlineSeconds:, completions:, parallelism:, podFailurePolicy:, ttlSecondsAfterFinished: }.merge(pod_template).compact } end |