Class: CronKubernetes::CronJob
- Inherits:
-
Object
- Object
- CronKubernetes::CronJob
- Defined in:
- lib/cron_kubernetes/cron_job.rb
Overview
A single job to run on a given schedule.
Instance Attribute Summary collapse
-
#command ⇒ Object
Returns the value of attribute command.
-
#identifier ⇒ Object
Returns the value of attribute identifier.
-
#job_manifest ⇒ Object
Returns the value of attribute job_manifest.
-
#name ⇒ Object
Returns the value of attribute name.
-
#schedule ⇒ Object
Returns the value of attribute schedule.
Instance Method Summary collapse
-
#cron_job_manifest ⇒ Object
rubocop:disable Metrics/MethodLength.
-
#initialize(schedule: nil, command: nil, job_manifest: nil, name: nil, identifier: nil) ⇒ CronJob
constructor
A new instance of CronJob.
Constructor Details
#initialize(schedule: nil, command: nil, job_manifest: nil, name: nil, identifier: nil) ⇒ CronJob
Returns a new instance of CronJob.
10 11 12 13 14 15 16 |
# File 'lib/cron_kubernetes/cron_job.rb', line 10 def initialize(schedule: nil, command: nil, job_manifest: nil, name: nil, identifier: nil) @schedule = schedule @command = command @job_manifest = job_manifest @name = name @identifier = identifier end |
Instance Attribute Details
#command ⇒ Object
Returns the value of attribute command.
8 9 10 |
# File 'lib/cron_kubernetes/cron_job.rb', line 8 def command @command end |
#identifier ⇒ Object
Returns the value of attribute identifier.
8 9 10 |
# File 'lib/cron_kubernetes/cron_job.rb', line 8 def identifier @identifier end |
#job_manifest ⇒ Object
Returns the value of attribute job_manifest.
8 9 10 |
# File 'lib/cron_kubernetes/cron_job.rb', line 8 def job_manifest @job_manifest end |
#name ⇒ Object
Returns the value of attribute name.
8 9 10 |
# File 'lib/cron_kubernetes/cron_job.rb', line 8 def name @name end |
#schedule ⇒ Object
Returns the value of attribute schedule.
8 9 10 |
# File 'lib/cron_kubernetes/cron_job.rb', line 8 def schedule @schedule end |
Instance Method Details
#cron_job_manifest ⇒ Object
rubocop:disable Metrics/MethodLength
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/cron_kubernetes/cron_job.rb', line 19 def cron_job_manifest { "apiVersion" => "batch/v1", "kind" => "CronJob", "metadata" => { "name" => "#{identifier}-#{cron_job_name}", "namespace" => namespace, "labels" => {"cron-kubernetes-identifier" => identifier} }, "spec" => { "schedule" => schedule, "jobTemplate" => { "metadata" => , "spec" => job_spec } } } end |