apiVersion: apps/v1
kind: Deployment
metadata:
  labels:
    app: dgraphql-v1
    version: v1
  name: dgraphql-v1
  namespace: sol-mainnet
spec:
  minReadySeconds: 0
  progressDeadlineSeconds: 600
  replicas: 2
  revisionHistoryLimit: 10
  selector:
    matchLabels:
      app: dgraphql-v1
      version: v1
  strategy:
    rollingUpdate:
      maxSurge: 50%
      maxUnavailable: 50%
    type: RollingUpdate
  template:
    metadata:
      labels:
        app: dgraphql-v1
        version: v1
      name: dgraphql-v1
    spec:
      affinity:
        podAntiAffinity:
          preferredDuringSchedulingIgnoredDuringExecution:
          - podAffinityTerm:
              labelSelector:
                matchExpressions:
                - key: app
                  operator: In
                  values:
                  - dgraphql-v1
              topologyKey: kubernetes.io/hostname
            weight: 10
      containers:
      - command:
        - /app/sfsol
        - start
        - graphql
        - --config-file=
        - --log-format=stackdriver
        - --log-to-file=false
        - --graphql-rpc-url=http://api.mainnet-beta.solana.com:80/rpc
        - --graphql-rpc-ws-url=ws://api.mainnet-beta.solana.com:80/rpc
        - --graphql-http-listen-addr=:8080
        - --graphql-config-name=mainnet
        - --graphql-slot-offset=100
        env:
        - name: GOOGLE_APPLICATION_CREDENTIALS
          value: /var/secrets/google/keyfile.json
        - name: INFO
          value: .*
        image: gcr.io/eoscanada-shared-services/sfsol:ab-bb43353
        imagePullPolicy: IfNotPresent
        name: dgraphql
        ports:
        - containerPort: 8080
          name: http-dgraphql
          protocol: TCP
        - containerPort: 9102
          name: prometheus
          protocol: TCP
        readinessProbe:
          failureThreshold: 2
          httpGet:
            path: /healthz
            port: 8080
            scheme: HTTP
          initialDelaySeconds: 5
          periodSeconds: 2
          successThreshold: 1
          timeoutSeconds: 1
        resources:
          limits:
            cpu: "1"
            memory: 1Gi
          requests:
            cpu: 13m
            memory: 50Mi
        terminationMessagePath: /dev/termination-log
        terminationMessagePolicy: File
        volumeMounts:
        - mountPath: /var/secrets/google
          name: google-cloud-key
      dnsPolicy: ClusterFirst
      restartPolicy: Always
      schedulerName: default-scheduler
      securityContext: {}
      serviceAccount: app-data-reader
      serviceAccountName: app-data-reader
      terminationGracePeriodSeconds: 5
      volumes:
      - name: google-cloud-key
        secret:
          defaultMode: 420
          secretName: keyfile-app-data-reader
