apiVersion: batch/v1
kind: CronJob
metadata:
  name: historical-prices-3d
  namespace: {{ .NAMESPACE }}
spec:
  schedule: {{ .HISTORICAL_PRICES_CRONTAB_SCHEDULE }}
  jobTemplate:
    spec:
      template:
        spec:
          containers:
            - name: historical-prices-3d
              image: {{ .IMAGE_NAME }}
              imagePullPolicy: Always
              env:
                - name: ENVIRONMENT
                  value: {{ .ENVIRONMENT }}
                - name: P2P_NETWORK
                  value: {{ .P2P_NETWORK }}
                - name: LOG_LEVEL
                  value: {{ .LOG_LEVEL }}
                - name: JOB_ID
                  value: JOB_HISTORICAL_PRICES
                - name: MONGODB_URI
                  valueFrom:
                    secretKeyRef:
                      name: mongodb
                      key: mongo-uri
                - name: MONGODB_DATABASE
                  valueFrom:
                    configMapKeyRef:
                      name: config
                      key: mongo-database
                - name: COINGECKO_URL
                  value: {{ .COINGECKO_URL }}
                - name: COINGECKO_HEADER_KEY
                  value: {{ .COINGECKO_HEADER_KEY }}
                - name: COINGECKO_API_KEY
                  valueFrom:
                    secretKeyRef:
                      name: jobs
                      key: coingecko-api-key
                - name: REQUEST_LIMIT_TIME_SECONDS
                  value: "{{ .REQUEST_LIMIT_TIME_SECONDS }}"
                - name: PRICE_DAYS
                  value: "3"
          restartPolicy: OnFailure