Sha256: e8c0dacf101429fe1d5a1507f649db0e288297f35cfdf7585eafb1d23099bc4e

Contents?: true

Size: 1.32 KB

Versions: 16

Compression:

Stored size: 1.32 KB

Contents

# frozen_string_literal: true

module Metatron
  module Templates
    # Template for basic Job k8s resource
    class Job < Template
      include Concerns::Annotated
      include Concerns::PodProducer
      include Concerns::Namespaced

      attr_accessor :backoff_limit, :completions, :parallelism, :restart_policy,
                    :pod_failure_policy, :active_deadline_seconds, :ttl_seconds_after_finished,
                    :suspend

      alias activeDeadlineSeconds active_deadline_seconds
      alias backoffLimit backoff_limit
      alias podFailurePolicy pod_failure_policy
      alias restartPolicy restart_policy
      alias ttlSecondsAfterFinished ttl_seconds_after_finished

      def initialize(name)
        super(name)
        @api_version = "batch/v1"
      end

      def render
        {
          apiVersion:,
          kind:,
          metadata: {
            labels: { "#{label_namespace}/name": name }.merge(additional_labels),
            name:
          }.merge(formatted_annotations).merge(formatted_namespace),
          spec: {
            suspend:,
            backoffLimit:,
            activeDeadlineSeconds:,
            completions:,
            parallelism:,
            podFailurePolicy:,
            ttlSecondsAfterFinished:
          }.merge(pod_template).compact
        }
      end
    end
  end
end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
metatron-0.6.0 lib/metatron/templates/job.rb
metatron-0.5.0 lib/metatron/templates/job.rb
metatron-0.4.2 lib/metatron/templates/job.rb
metatron-0.4.1 lib/metatron/templates/job.rb
metatron-0.4.0 lib/metatron/templates/job.rb
metatron-0.3.4 lib/metatron/templates/job.rb
metatron-0.3.3 lib/metatron/templates/job.rb
metatron-0.3.2 lib/metatron/templates/job.rb
metatron-0.3.1 lib/metatron/templates/job.rb
metatron-0.3.0 lib/metatron/templates/job.rb
metatron-0.2.8 lib/metatron/templates/job.rb
metatron-0.2.7 lib/metatron/templates/job.rb
metatron-0.2.6 lib/metatron/templates/job.rb
metatron-0.2.5 lib/metatron/templates/job.rb
metatron-0.2.4 lib/metatron/templates/job.rb
metatron-0.2.3 lib/metatron/templates/job.rb