---
apiVersion: batch/v1
kind: Job
metadata:
  name: {{ .NAME }}
  namespace: {{ .NAMESPACE }}
spec:
  template:
    metadata:
      labels:
        app: {{ .NAME }}
    spec:
      restartPolicy: Never
      terminationGracePeriodSeconds: 40
      containers:
        - name: {{ .NAME }}
          image: {{ .IMAGE_NAME }}
          imagePullPolicy: Always
          env:
            - name: ENV
              value: "PRODUCTION"
            - name: LOG_LEVEL
              value: "DEBUG"
            - name: MONGODB_URI
              valueFrom:
                secretKeyRef:
                  name: mongodb
                  key: mongo-uri
            - name: MONGODB_DATABASE
              valueFrom:
                configMapKeyRef:
                  name: config
                  key: mongo-database
            - name: VAA_PAYLOAD_PARSER_URL
              value: {{ .VAA_PAYLOAD_PARSER_URL }}
            - name: VAA_PAYLOAD_PARSER_TIMEOUT
              value: "{{ .VAA_PAYLOAD_PARSER_TIMEOUT }}"
            - name: SOLANA_BASE_URL
              value: {{ .SOLANA_BASE_URL }}
            - name: SOLANA_REQUESTS_PER_MINUTE
              value: "{{ .SOLANA_REQUESTS_PER_MINUTE }}"
            - name: NUM_WORKERS
              value: "100"
            - name: BULK_SIZE
              value: "1000"
            - name: STRATEGY_NAME
              value: "{{ .STRATEGY_NAME }}"
            - name: STRATEGY_TIMESTAMP_AFTER
              value: "{{ .STRATEGY_TIMESTAMP_AFTER }}"
            - name: STRATEGY_TIMESTAMP_BEFORE
              value: "{{ .STRATEGY_TIMESTAMP_BEFORE }}"
          resources:
            limits:
              memory: {{ .RESOURCES_LIMITS_MEMORY }}
              cpu: {{ .RESOURCES_LIMITS_CPU }}
            requests:
              memory: {{ .RESOURCES_REQUESTS_MEMORY }}
              cpu: {{ .RESOURCES_REQUESTS_CPU }}
