Class: Metatron::Templates::CronJob
- Inherits:
-
Metatron::Template
- Object
- Metatron::Template
- Metatron::Templates::CronJob
- Includes:
- Metatron::Templates::Concerns::Annotated, Metatron::Templates::Concerns::Namespaced, Metatron::Templates::Concerns::PodProducer
- Defined in:
- lib/metatron/templates/cron_job.rb
Overview
Template for basic CronJob k8s resource
Instance Attribute Summary collapse
-
#backoff_limit ⇒ Object
(also: #backoffLimit)
Returns the value of attribute backoff_limit.
-
#concurrency_policy ⇒ Object
(also: #concurrencyPolicy)
Returns the value of attribute concurrency_policy.
-
#failed_jobs_history_limit ⇒ Object
(also: #failedJobsHistoryLimit)
Returns the value of attribute failed_jobs_history_limit.
-
#schedule ⇒ Object
Returns the value of attribute schedule.
-
#starting_deadline_seconds ⇒ Object
(also: #startingDeadlineSeconds)
Returns the value of attribute starting_deadline_seconds.
-
#successful_jobs_history_limit ⇒ Object
(also: #successfulJobsHistoryLimit)
Returns the value of attribute successful_jobs_history_limit.
-
#suspend ⇒ Object
Returns the value of attribute suspend.
Attributes inherited from Metatron::Template
#additional_labels, #api_version, #base_labels, #kind, #name
Instance Method Summary collapse
-
#initialize(name, schedule = "* * * * *") ⇒ CronJob
constructor
A new instance of CronJob.
-
#render ⇒ Object
rubocop:disable Metrics/AbcSize.
Methods included from Metatron::Templates::Concerns::Namespaced
#formatted_namespace, included, #namespaced_initialize
Methods included from Metatron::Templates::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 Metatron::Templates::Concerns::Annotated
#annotated_initialize, #formatted_annotations, included
Methods inherited from Metatron::Template
initializer, initializers, metatron_template_class?, nearest_metatron_ancestor
Constructor Details
#initialize(name, schedule = "* * * * *") ⇒ CronJob
Returns a new instance of CronJob.
21 22 23 24 25 |
# File 'lib/metatron/templates/cron_job.rb', line 21 def initialize(name, schedule = "* * * * *") super(name) @schedule = schedule @api_version = "batch/v1" end |
Instance Attribute Details
#backoff_limit ⇒ Object Also known as: backoffLimit
Returns the value of attribute backoff_limit.
11 12 13 |
# File 'lib/metatron/templates/cron_job.rb', line 11 def backoff_limit @backoff_limit end |
#concurrency_policy ⇒ Object Also known as: concurrencyPolicy
Returns the value of attribute concurrency_policy.
11 12 13 |
# File 'lib/metatron/templates/cron_job.rb', line 11 def concurrency_policy @concurrency_policy end |
#failed_jobs_history_limit ⇒ Object Also known as: failedJobsHistoryLimit
Returns the value of attribute failed_jobs_history_limit.
11 12 13 |
# File 'lib/metatron/templates/cron_job.rb', line 11 def failed_jobs_history_limit @failed_jobs_history_limit end |
#schedule ⇒ Object
Returns the value of attribute schedule.
11 12 13 |
# File 'lib/metatron/templates/cron_job.rb', line 11 def schedule @schedule end |
#starting_deadline_seconds ⇒ Object Also known as: startingDeadlineSeconds
Returns the value of attribute starting_deadline_seconds.
11 12 13 |
# File 'lib/metatron/templates/cron_job.rb', line 11 def starting_deadline_seconds @starting_deadline_seconds end |
#successful_jobs_history_limit ⇒ Object Also known as: successfulJobsHistoryLimit
Returns the value of attribute successful_jobs_history_limit.
11 12 13 |
# File 'lib/metatron/templates/cron_job.rb', line 11 def successful_jobs_history_limit @successful_jobs_history_limit end |
#suspend ⇒ Object
Returns the value of attribute suspend.
11 12 13 |
# File 'lib/metatron/templates/cron_job.rb', line 11 def suspend @suspend end |
Instance Method Details
#render ⇒ Object
rubocop:disable Metrics/AbcSize
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 |
# File 'lib/metatron/templates/cron_job.rb', line 28 def render { apiVersion:, kind:, metadata: { labels: base_labels.merge(additional_labels), name: }.merge(formatted_annotations).merge(formatted_namespace), spec: { schedule:, suspend:, concurrencyPolicy:, startingDeadlineSeconds:, successfulJobsHistoryLimit:, failedJobsHistoryLimit:, jobTemplate: { spec: { backoffLimit: }.merge(pod_template).compact }.merge(formatted_tolerations).compact }.compact } end |