---
apiVersion: apps/v1
kind: StatefulSet
metadata:
  name: data-transport-layer
spec:
  replicas: 1
  serviceName: data-transport-layer
  template:
    spec:
      terminationGracePeriodSeconds: 10
      restartPolicy: Always
      initContainers:
      - name: wait-for-l1
        image: nicolaka/netshoot
        command: ['bash', '-c', '/script/wait/wait-for-l1.sh']
        volumeMounts:
          - name: wait-scripts
            mountPath: /script/wait
        envFrom:
          - configMapRef:
              name: data-transport-layer
          - configMapRef:
              name: data-transport-layer-sync-source
      containers:
      - name: data-transport-layer
        image: ethereumoptimism/data-transport-layer
        imagePullPolicy: Always
        envFrom:
          - configMapRef:
              name: data-transport-layer
          - configMapRef:
              name: data-transport-layer-sync-source
        ports:
          - containerPort: 7878
            protocol: TCP
        volumeMounts:
          - name: liveliness-script
            mountPath: /script/liveliness
          - name: data-transport-layer
            mountPath: /db
        livenessProbe:
          exec:
            command:
              - /script/liveliness/test.sh
              - data-transport-layer.js
          initialDelaySeconds: 15
          periodSeconds: 10
        resources: {}
      volumes:
        - name: data-transport-layer
          emptyDir: {}
        - name: liveliness-script
          configMap:
            name: liveliness-script
            defaultMode: 0777
        - name: wait-scripts
          configMap:
            name: wait-scripts
            defaultMode: 0777
