---

apiVersion: apps/v1
kind: StatefulSet
metadata:
  name: validator
spec:
  serviceName: validator
  replicas: 2
  selector:
    matchLabels:
      app: validator
  volumeClaimTemplates:
    - metadata:
        name: celo-data
      spec:
        accessModes:
          - ReadWriteOnce
        resources:
          requests:
            storage: 64Gi
  template:
    metadata:
      labels:
        app: validator
    spec:
      automountServiceAccountToken: true
      serviceAccount: validator
      serviceAccountName: validator
      volumes:
        - name: celo-data
          persistentVolumeClaim:
            claimName: celo-data
      containers:
        - name: elector
          image: mantalabs/validator-elector:latest
          imagePullPolicy: Always
          args:
            - -node-id=$(POD_NAME)
            - -lease-namespace=$(POD_NAMESPACE)
            - -lease-name=validator-lease
          env:
            - name: POD_NAME
              valueFrom:
                fieldRef:
                  apiVersion: v1
                  fieldPath: metadata.name
            - name: POD_NAMESPACE
              valueFrom:
                fieldRef:
                  apiVersion: v1
                  fieldPath: metadata.namespace
        - name: celo
          image: us.gcr.io/celo-org/geth:1.2.1
          args:
            - --verbosity=3
            - --syncmode=full
            - --rpc
            - --rpcaddr=0.0.0.0
            - --rpcapi=eth,net,web3,debug,admin,personal,istanbul
            - --light.serve=90
            - --light.maxpeers=1000
            - --maxpeers=1100
            - --nousb
            - --baklava
          volumeMounts:
            - name: celo-data
              mountPath: /root/.celo
