apiVersion: apps/v1
kind: StatefulSet
metadata:
  name: explorer
  labels:
    app: multinet
    tier: explorer
spec:
  serviceName: explorer
  selector:
    matchLabels:
      tier: explorer
  template:
    metadata:
      labels:
        tier: explorer
    spec:
      volumes:
        - name: common-data
          persistentVolumeClaim:
            claimName: common-data
      containers:
        - name: eth2-beaconchain-explorer
          image: silesiacoin/eth2-beaconchain-explorer:v5
          imagePullPolicy: IfNotPresent
          ports:
            - containerPort: 3333
          env:
            - name: POSTGRES_PASSWORD
              value: "{{ .Values.POSTGRES_PASSWORD }}"
            - name: POSTGRES_USER
              value: "{{ .Values.POSTGRES_USER }}"
            - name: POSTGRES_DB
              value: "{{ .Values.POSTGRES_DB }}"
            - name: PGDATA
              value: "{{ .Values.PGDATA }}"
            - name: MULTINET_POD_NAME
              valueFrom:
                fieldRef:
                  fieldPath: metadata.name
            - name: MULTINET_POD_IP
              valueFrom:
                fieldRef:
                  fieldPath: status.podIP
        - name: postgres
          image: postgres:12.0
          imagePullPolicy: IfNotPresent
          ports:
            - containerPort: 5432
          env:
            - name: POSTGRES_PASSWORD
              value: "{{ .Values.POSTGRES_PASSWORD }}"
            - name: POSTGRES_USER
              value: "{{ .Values.POSTGRES_USER }}"
            - name: POSTGRES_DB
              value: "{{ .Values.POSTGRES_DB }}"
            - name: PGDATA
              value: "{{ .Values.PGDATA }}"
            - name: MULTINET_POD_NAME
              valueFrom:
                fieldRef:
                  fieldPath: metadata.name
            - name: MULTINET_POD_IP
              valueFrom:
                fieldRef:
                  fieldPath: status.podIP
          volumeMounts:
            - mountPath: /root/multinet/postgresql/data
              name: common-data
