Sha256: 8b4cd8e95bdc5c394e46262ee1fc4f10496bda900edf23f68b6a01c2f3a8fccd

Contents?: true

Size: 1.51 KB

Versions: 11

Compression:

Stored size: 1.51 KB

Contents

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

      def deployment
        {
          kind: "Deployment",
          apiVersion: "apps/v1",
          metadata: {
            name: @data['deployed_name'],
            namespace: @data['env'],
            labels: {
              application: @data['application'],
              "deployed-name" => @data['deployed_name'],
              "application-type" => "daemon",
            }
          },
          spec: {
            replicas: get("replicas") || 1,
            selector: {
              matchLabels: {
                "deployed-name" => @data['deployed_name'],
              },
            },
            strategy: {
              type: "Recreate"
            },
            revisionHistoryLimit: 5,
            template: {
              metadata: {
                labels: {
                  application: @data['application'],
                  "deployed-name" => @data['deployed_name'],
                  "application-type" => "daemon",
                },
              },
              spec: {
                containers: [
                  {
                    image: image_name,
                    name: @data['deployed_name'],
                    command: get("command").split(" "),
                    env: env_vars,
                    resources: resources,
                  }
                ]
              },
            },
          },
        }
      end
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
pfab-0.33.0 lib/pfab/templates/daemon.rb
pfab-0.19.0 lib/pfab/templates/daemon.rb
pfab-0.18.0 lib/pfab/templates/daemon.rb
pfab-0.17.0 lib/pfab/templates/daemon.rb
pfab-0.16.0 lib/pfab/templates/daemon.rb
pfab-0.15.0 lib/pfab/templates/daemon.rb
pfab-0.14.0 lib/pfab/templates/daemon.rb
pfab-0.13.0 lib/pfab/templates/daemon.rb
pfab-0.12.0 lib/pfab/templates/daemon.rb
pfab-0.11.0 lib/pfab/templates/daemon.rb
pfab-0.10.0 lib/pfab/templates/daemon.rb