apiVersion: apps/v1
kind: Deployment
metadata:
  name: www-deployment
spec:
  replicas: 3
  revisionHistoryLimit: 2
  strategy:
    type: RollingUpdate
  selector:
    matchLabels:
      app: www
  template:
    metadata:
      labels:
        app: www
    spec:
      volumes:
      - name: secrets
        secret:
          secretName: gcloud
      containers:
      - name: www-container
        image: gcr.io/staffjoy-prod/www:VERSION
        ports:
        - containerPort: 80
        livenessProbe:
          httpGet:
            path: /health
            port: 80
        readinessProbe:
          httpGet:
            path: /health
            port: 80
        volumeMounts:
        - name: secrets    
          mountPath: "/etc/secrets"
          readOnly: true
        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: SIGNING_SECRET
          valueFrom:
            secretKeyRef:
              name: signing
              key: secret
        - name: GCLOUD_PROJECT
          value: staffjoy-prod
        - name: RECAPTCHA_PUBLIC
          valueFrom:
            secretKeyRef:
              name: recaptcha
              key: public
        - name: RECAPTCHA_PRIVATE
          valueFrom:
            secretKeyRef:
              name: recaptcha
              key: secret
        - name: SUITE_API_KEY
          valueFrom:
            secretKeyRef:
              name: suite
              key: apikey