apiVersion: apps/v1
kind: Deployment
metadata:
  labels:
    name: fw-teams
  name: fw-teams
  namespace: fw
spec:
  progressDeadlineSeconds: 2147483647
  replicas: 1
  revisionHistoryLimit: 2
  selector:
    matchLabels:
      name: fw-teams
  strategy:
    rollingUpdate:
      maxSurge: 1
      maxUnavailable: 1
    type: RollingUpdate
  template:
    metadata:
      annotations:
        chaos.alpha.kubernetes.io/enabled: "true"
      labels:
        name: fw-teams
    spec:
      affinity:
        nodeAffinity:
          requiredDuringSchedulingIgnoredDuringExecution:
            nodeSelectorTerms:
              - matchExpressions:
                  - key: type
                    operator: In
                    values:
                      - gfw
      containers:
        - args:
            - start
          env:
            - name: PORT
              value: "3035"
            - name: NODE_ENV
              value: prod
            - name: NODE_PATH
              value: app/src
            - name: LOCAL_URL
              value: http://fw-teams.fw.svc.cluster.local:3035
            - name: MONGO_URI
              valueFrom:
                secretKeyRef:
                  key: TEAMS_MONGO_URI
                  name: dbsecrets
            - name: CT_URL
              valueFrom:
                secretKeyRef:
                  key: CT_URL
                  name: mssecrets
            - name: CT_TOKEN
              valueFrom:
                secretKeyRef:
                  key: CT_TOKEN
                  name: mssecrets
            - name: CT_REGISTER_MODE
              valueFrom:
                secretKeyRef:
                  key: CT_REGISTER_MODE
                  name: mssecrets
            - name: API_VERSION
              valueFrom:
                secretKeyRef:
                  key: API_VERSION
                  name: mssecrets
            - name: API_GATEWAY_URL
              value: http://production-api.globalforestwatch.org
            - name: API_GATEWAY_EXTERNAL_URL
              value: http://production-api.globalforestwatch.org
            - name: API_GATEWAY_QUEUE_NAME
              value: mail_prod
            - name: API_GATEWAY_QUEUE_URL
              valueFrom:
                secretKeyRef:
                  key: REDIS_URI
                  name: dbsecrets
            - name: JWT_SECRET
              valueFrom:
                secretKeyRef:
                  key: FW_TEAMS_JWT_SECRET
                  name: mssecrets
            - name: APP_URL
              value: https://forest-watcher.herokuapp.com
            - name: FASTLY_ENABLED
              valueFrom:
                secretKeyRef:
                  key: FASTLY_ENABLED
                  name: mssecrets
            - name: FASTLY_APIKEY
              valueFrom:
                secretKeyRef:
                  key: FASTLY_APIKEY
                  name: mssecrets
                  optional: true
            - name: FASTLY_SERVICEID
              valueFrom:
                secretKeyRef:
                  key: FASTLY_SERVICEID
                  name: mssecrets
                  optional: true
          image: gfwdockerhub/fw-teams
          imagePullPolicy: Always
          livenessProbe:
            failureThreshold: 3
            httpGet:
              path: /healthcheck
              port: 3035
              scheme: HTTP
            initialDelaySeconds: 30
            periodSeconds: 15
            successThreshold: 1
            timeoutSeconds: 5
          name: fw-teams
          ports:
            - containerPort: 3035
              protocol: TCP
          readinessProbe:
            failureThreshold: 3
            httpGet:
              path: /healthcheck
              port: 3035
              scheme: HTTP
            initialDelaySeconds: 30
            periodSeconds: 15
            successThreshold: 1
            timeoutSeconds: 5
          resources:
            limits:
              cpu: "1"
              memory: 512M
            requests:
              cpu: 250m
              memory: 256M
          terminationMessagePath: /dev/termination-log
          terminationMessagePolicy: File
      dnsPolicy: ClusterFirst
      imagePullSecrets:
        - name: regcred
      restartPolicy: Always
      schedulerName: default-scheduler
      securityContext: {}
      terminationGracePeriodSeconds: 30
