apiVersion: apps/v1
kind: Deployment
metadata:
  labels:
    name: area
  name: area
  namespace: gfw
spec:
  progressDeadlineSeconds: 2147483647
  revisionHistoryLimit: 0
  selector:
    matchLabels:
      name: area
  strategy:
    rollingUpdate:
      maxSurge: 1
      maxUnavailable: 1
    type: RollingUpdate
  template:
    metadata:
      labels:
        name: area
    spec:
      affinity:
        nodeAffinity:
          requiredDuringSchedulingIgnoredDuringExecution:
            nodeSelectorTerms:
              - matchExpressions:
                  - key: type
                    operator: In
                    values:
                      - apps
      containers:
        - args:
            - start
          env:
            - name: PORT
              value: "4100"
            - name: NODE_OPTIONS
              value: "--max-old-space-size=1024"
            - name: NODE_ENV
              value: staging
            - name: NODE_PATH
              value: app/src
            - name: LOCAL_URL
              value: http://area.gfw.svc.cluster.local:4100
            - name: GLAD_DATASET
              value: e663eb09-04de-4f39-b871-35c6c2ed10b5
            - name: VIIRS_DATASET
              value: 20cc5eca-8c63-4c41-8e8e-134dcf1e6d76
            - name: VIIRS_DATASET_TABLENAME
              value: vnp14imgtdl_nrt_global_7d
            - name: MONGO_USE_UNIFIED_TOPOLOGY
              value: "false"
            - name: MONGO_URI
              valueFrom:
                secretKeyRef:
                  key: AREA_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: S3_ACCESS_KEY_ID
              valueFrom:
                secretKeyRef:
                  key: AREA_S3_ACCESS_KEY_ID
                  name: mssecrets
            - name: S3_SECRET_ACCESS_KEY
              valueFrom:
                secretKeyRef:
                  key: AREA_S3_SECRET_ACCESS_KEY
                  name: mssecrets
            - name: AOI_DATA_S3_ACCESS_KEY_ID
              valueFrom:
                secretKeyRef:
                  key: AREA_AOI_DATA_S3_ACCESS_KEY_ID
                  name: mssecrets
            - name: AOI_DATA_S3_SECRET_ACCESS_KEY
              valueFrom:
                secretKeyRef:
                  key: AREA_AOI_DATA_S3_SECRET_ACCESS_KEY
                  name: mssecrets
            - name: AOI_DATA_S3_BUCKET
              value: gfw-pipelines
            - name: S3_BUCKET
              value: forest-watcher-files
            - name: DEFORESTATION_ALERTS_DATASET_ID
              value: glad-alerts
            - name: FIRE_ALERTS_DATASET_ID
              value: viirs-active-fires
            - name: MONTHLY_SUMMARY_DATASET_ID
              value: monthly-summary
            - name: SPARKPOST_KEY
              valueFrom:
                secretKeyRef:
                  key: SPARKPOST_KEY
                  name: mssecrets
            - 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/area
          imagePullPolicy: Always
          livenessProbe:
            failureThreshold: 3
            httpGet:
              path: /healthcheck
              port: 4100
              scheme: HTTP
            initialDelaySeconds: 30
            periodSeconds: 15
            successThreshold: 1
            timeoutSeconds: 5
          name: area
          ports:
            - containerPort: 4100
              protocol: TCP
          readinessProbe:
            failureThreshold: 3
            httpGet:
              path: /healthcheck
              port: 4100
              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
