---
apiVersion: apps/v1
kind: StatefulSet
metadata:
  name: l2geth-replica
spec:
  template:
    spec:
      containers:
        - name: l2geth-replica
          command:
            - geth
            - --config=/l2geth-config/l2geth.toml
            - --datadir=$(DATADIR)
            - --password=$(DATADIR)/password
            - --allow-insecure-unlock
            - --unlock=$(BLOCK_SIGNER_ADDRESS)
            - --mine
            - --miner.etherbase=$(BLOCK_SIGNER_ADDRESS)
            - --metrics
            - --metrics.influxdb
            - --metrics.influxdb.endpoint=http://influxdb.monitoring:8086
            - --metrics.influxdb.database=$(NAMESPACE)
          resources:
            limits:
              cpu: "8"
              memory: 24Gi
            requests:
              cpu: "4"
              memory: 12Gi
---
apiVersion: apps/v1
kind: StatefulSet
metadata:
  name: data-transport-layer
spec:
  template:
    spec:
      initContainers:
        - name: wait-for-l1
          env:
            - name: L1_NODE_WEB3_URL
              valueFrom:
                secretKeyRef:
                  name: replica-secrets
                  key: l1-rpc-endpoint
      containers:
        - name: data-transport-layer
          resources:
            limits:
              cpu: "2"
              memory: 4Gi
            requests:
              cpu: "1"
              memory: 1Gi
          env:
            - name: DATA_TRANSPORT_LAYER__L1_RPC_ENDPOINT
              valueFrom:
                secretKeyRef:
                  name: replica-secrets
                  key: l1-rpc-endpoint
            - name: DATA_TRANSPORT_LAYER__L2_RPC_ENDPOINT
              valueFrom:
                secretKeyRef:
                  name: replica-secrets
                  key: l2-rpc-endpoint
            - name: L1_NODE_WEB3_URL
              valueFrom:
                secretKeyRef:
                  name: replica-secrets
                  key: l1-rpc-endpoint