Sha256: 089ffdccf8e6c1da8e2e966904e1b9567a1caf2dc45c62c5aceaed7d8712ea12

Contents?: true

Size: 1.39 KB

Versions: 22

Compression:

Stored size: 1.39 KB

Contents

module Pfab
  module Templates
    class Job < Base
      def write_to(f)
        f << YAML.dump(job.deep_stringify_keys)
      end

      def job
        {
          apiVersion: "batch/v1",
          kind: "Job",
          metadata: {
            name: "job-#{@data['deployed_name']}-#{@data['sha']}",
            namespace: @data['env'],
            labels: {
              application: @data['application'],
              "deployed-name" => @data['deployed_name'],
              "application-type" => "job",
            }
          },
          spec: {
            template: {
              metadata: {
                name: "#{@data['deployed_name']}-#{@data['sha']}",
                namespace: @data['env'],
                labels: {
                  application: @data['application'],
                  "deployed-name" => @data['deployed_name'],
                  "application-type" => "job",
                },
              },
              spec: {
                containers: [
                  {
                    image: image_name,
                    name: @data['deployed_name'],
                    command: app_vars["command"].split(" "),
                    env: env_vars,
                    resources: resources,
                  },
                ],
                restartPolicy: "Never",
              },
            },
            backoffLimit: 0,
          },
        }
      end
    end
  end
end

Version data entries

22 entries across 22 versions & 1 rubygems

Version Path
pfab-0.33.0 lib/pfab/templates/job.rb
pfab-0.19.0 lib/pfab/templates/job.rb
pfab-0.18.0 lib/pfab/templates/job.rb
pfab-0.17.0 lib/pfab/templates/job.rb
pfab-0.16.0 lib/pfab/templates/job.rb
pfab-0.15.0 lib/pfab/templates/job.rb
pfab-0.14.0 lib/pfab/templates/job.rb
pfab-0.13.0 lib/pfab/templates/job.rb
pfab-0.12.0 lib/pfab/templates/job.rb
pfab-0.11.0 lib/pfab/templates/job.rb
pfab-0.10.0 lib/pfab/templates/job.rb
pfab-0.9.0 lib/pfab/templates/job.rb
pfab-0.8.4 lib/pfab/templates/job.rb
pfab-0.8.3 lib/pfab/templates/job.rb
pfab-0.8.2 lib/pfab/templates/job.rb
pfab-0.8.1 lib/pfab/templates/job.rb
pfab-0.8.0 lib/pfab/templates/job.rb
pfab-0.7.0 lib/pfab/templates/job.rb
pfab-0.6.0 lib/pfab/templates/job.rb
pfab-0.5.0 lib/pfab/templates/job.rb