apiVersion: apps/v1
kind: StatefulSet
metadata:
  name: indexer-service
spec:
  serviceName: indexer-service
  selector:
    matchLabels:
      app: indexer-service
  replicas: 1
  template:
    metadata:
      labels:
        app: indexer-service
      annotations:
        prometheus.io/scrape: "true"
        prometheus.io/path: "/metrics"
        prometheus.io/port: "7300"
    spec:
      containers:
        - name: indexer-service
          image: indexer-service-image
          imagePullPolicy: Always
          resources:
            requests:
              cpu: 600m
          ports:
            - name: http
              containerPort: 7600
            - name: metrics
              containerPort: 7300
          env:
            - name: INDEXER_SERVICE_PORT
              value: "7600"
            - name: INDEXER_SERVICE_MNEMONIC
              valueFrom:
                secretKeyRef:
                  name: indexer
                  key: mnemonic
            - name: INDEXER_SERVICE_INDEXER_ADDRESS
              valueFrom:
                secretKeyRef:
                  name: indexer
                  key: indexer_address
            - name: INDEXER_SERVICE_ETHEREUM_NETWORK
              valueFrom:
                secretKeyRef:
                  name: ethereum
                  key: network_name
            - name: INDEXER_SERVICE_ETHEREUM
              valueFrom:
                secretKeyRef:
                  name: ethereum
                  key: url
            - name: INDEXER_SERVICE_NETWORK_SUBGRAPH_ENDPOINT
              value: http://index-eragent.default.svc.cluster.local:8002/network
            - name: INDEXER_SERVICE_GRAPH_NODE_QUERY_ENDPOINT
              value: http://query-node.default.svc.cluster.local/
            - name: INDEXER_SERVICE_GRAPH_NODE_STATUS_ENDPOINT
              value: http://query-node.default.svc.cluster.local/index-node/graphql
            - name: INDEXER_SERVICE_NETWORK_SUBGRAPH_ENDPOINT
              value: https://gateway.network.thegraph.com/network
            - name: INDEXER_SERVICE_POSTGRES_HOST
              valueFrom:
                secretKeyRef:
                  name: postgres-credentials
                  key: host
            - name: INDEXER_SERVICE_POSTGRES_USERNAME
              valueFrom:
                secretKeyRef:
                  name: postgres-credentials
                  key: user
            - name: INDEXER_SERVICE_POSTGRES_PASSWORD
              valueFrom:
                secretKeyRef:
                  name: postgres-credentials
                  key: password
            - name: INDEXER_SERVICE_POSTGRES_DATABASE
              valueFrom:
                secretKeyRef:
                  name: postgres-credentials
                  key: indexer_db
            - name: INDEXER_SERVICE_FREE_QUERY_AUTH_TOKEN
              valueFrom:
                secretKeyRef:
                  name: free-query-auth-token
                  key: token
            - name: INDEXER_SERVICE_CLIENT_SIGNER_ADDRESS
              valueFrom:
                secretKeyRef:
                  name: scalar
                  key: client_signer_address
