Sha256: 86dc4a8f47587c8526c5a52275c64a3fca02c5130f89d71e704fc65aab8e660c

Contents?: true

Size: 1.12 KB

Versions: 2

Compression:

Stored size: 1.12 KB

Contents

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

      def job
        {
          kind: "Pod",
          apiVersion: "v1",
          metadata: {
            name: "#{@data['deployed_name']}-#{@data['sha']}",
            namespace: @data['env'],
            labels: {
              application: @data['application'],
              "deployed-name" => @data['deployed_name'],
            }
          },
          spec: {
            containers: [
              {
                image: image_name,
                name: @data['deployed_name'],
                command: app_vars["command"].split(" "),
                env: env_vars,
                resources: {
                  requests: {
                    cpu: @data["cpu"] || "50m",
                    memory: @data["memory"] || "256Mi",
                  },
                  limits: {
                    cpu: @data["cpu"] || "250m",
                    memory: @data["memory"] || "256Mi",
                  },
                },
              }
            ]
          }
        }
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
pfab-0.1.1 lib/pfab/templates/job.rb
pfab-0.1.0 lib/pfab/templates/job.rb