apiVersion: apps/v1
kind: Deployment
metadata:
  name: emailserver-deployment
spec:
  replicas: 2
  revisionHistoryLimit: 2
  strategy:
    type: RollingUpdate
  selector:
    matchLabels:
      app: emailserver
  template:
    metadata:
      labels:
        app: emailserver
    spec:
      containers:
      - name: emailserver-container
        image: gcr.io/staffjoy-prod/emailserver:VERSION
        ports:
        - containerPort: 80
        - containerPort: 1000
        livenessProbe:
          httpGet:
            path: /health
            port: 80
        readinessProbe:
          httpGet:
            path: /health
            port: 80
        env:
        - name: DEPLOY
          value: VERSION # Gets replaced during deploy
        - name: ENV
          valueFrom:
            fieldRef:
              fieldPath: metadata.namespace
        - name: SENTRY_DSN
          valueFrom:
            secretKeyRef:
              name: sentry
              key: dsn
        - name: MAILGUN_DOMAIN
          valueFrom:
            secretKeyRef:
              name: mailgun_domain
              key: domain
        - name: MAILGUN_API_KEY
          valueFrom:
            secretKeyRef:
              name: mailgun_api_key
              key: key

