apiVersion: apps/v1
kind: Deployment
metadata:
    name: events-collector
    namespace: data
spec:
    minReadySeconds: 30
    replicas: 3
    strategy:
        type: RollingUpdate
        rollingUpdate:
            maxUnavailable: 1
            maxSurge: 1
    selector:
        matchLabels:
            app: events-collector
    template:
        metadata:
            labels:
                app: events-collector
        spec:
            volumes:
                - name: bigquery-google-cloud-credentials
                  secret:
                      secretName: bigquery-key
            containers:
                - name: events-collector
                  image: bufferapp/events-collector:0.7.0
                  imagePullPolicy: Always
                  volumeMounts:
                      - name: bigquery-google-cloud-credentials
                        mountPath: /var/secrets/google
                  readinessProbe:
                      periodSeconds: 5
                      exec:
                          command: ["/bin/grpc_health_probe", "-addr=:50051"]
                  livenessProbe:
                      periodSeconds: 5
                      exec:
                          command: ["/bin/grpc_health_probe", "-addr=:50051"]
                  resources:
                      limits:
                          cpu: 1500m
                          memory: 3500Mi
                  env:
                      - name: AWS_ACCESS_KEY_ID
                        valueFrom:
                            secretKeyRef:
                                name: aws
                                key: access-key-id
                      - name: AWS_SECRET_ACCESS_KEY
                        valueFrom:
                            secretKeyRef:
                                name: aws
                                key: secret-access-key
                      - name: AWS_DEFAULT_REGION
                        valueFrom:
                            secretKeyRef:
                                name: aws
                                key: default-region
                      - name: GOOGLE_APPLICATION_CREDENTIALS
                        value: /var/secrets/google/key.json
                  ports:
                      - name: grpc
                        containerPort: 50051
            imagePullSecrets:
                - name: dhbufferapp
