apiVersion: apps/v1
kind: Deployment
metadata:
  labels:
    app: dreamkast
    tier: dreamkast-fifo-worker
  name: dreamkast-fifo-worker
spec:
  selector:
    matchLabels:
      app: dreamkast
      tier: dreamkast-fifo-worker
  strategy:
    rollingUpdate:
      maxSurge: 25%
      maxUnavailable: 25%
    type: RollingUpdate
  template:
    metadata:
      labels:
        app: dreamkast
        tier: dreamkast-fifo-worker
    spec:
      containers:
      - args:
        - exec
        - aws_sqs_active_job
        - --queue
        - fifo
        command:
        - bundle
        env:
        - name: RAILS_ENV
          value: production
        - name: AWS_REGION
          value: ap-northeast-1
        - name: MYSQL_HOST
          value: dreamkast-mysql
        - name: REDIS_URL
          value: redis://dreamkast-redis:6379
        - name: SENTRY_DSN
          value: https://443f0535beb64cd8b2e995d001e0903b@o414348.ingest.sentry.io/5350644
        - name: S3_BUCKET
          value: dreamkast-test-bucket
        - name: S3_REGION
          value: ap-northeast-1
        - name: SQS_MAIL_QUEUE_URL
          value: https://sqs.ap-northeast-1.amazonaws.com/607167088920/dreamkast-devFifoQueue.fifo
        - name: SQS_FIFO_QUEUE_URL
          value: https://sqs.ap-northeast-1.amazonaws.com/607167088920/dreamkast-devFifoQueue.fifo
        - name: DREAMKAST_NAMESPACE
          valueFrom:
            fieldRef:
              fieldPath: metadata.namespace
        - name: RAILS_MASTER_KEY
          valueFrom:
            secretKeyRef:
              key: rails-app-secret
              name: rails-app-secret
        - name: AUTH0_CLIENT_ID
          valueFrom:
            secretKeyRef:
              key: AUTH0_CLIENT_ID
              name: dreamkast-secret
        - name: AUTH0_CLIENT_SECRET
          valueFrom:
            secretKeyRef:
              key: AUTH0_CLIENT_SECRET
              name: dreamkast-secret
        - name: AUTH0_DOMAIN
          valueFrom:
            secretKeyRef:
              key: AUTH0_DOMAIN
              name: dreamkast-secret
        - name: REVIEW_APP
          valueFrom:
            secretKeyRef:
              key: REVIEW_APP
              name: dreamkast-secret
        image: 607167088920.dkr.ecr.ap-northeast-1.amazonaws.com/dreamkast-ecs:main
        imagePullPolicy: Always
        lifecycle:
          preStop:
            exec:
              command:
              - /bin/sleep
              - "300"
        name: dreamkast
        resources:
          limits:
            cpu: 500m
            memory: 512Mi
          requests:
            cpu: 400m
            memory: 256Mi
