apiVersion: batch/v1
kind: CronJob
metadata:
  name: notional
  namespace: {{ .NAMESPACE }}
spec:
  schedule: "{{ .NOTIONAL_CRONTAB_SCHEDULE }}"
  jobTemplate:
    spec:
      template:
        spec:
          serviceAccountName: jobs
          containers:
          - name: {{ .NAME }}
            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_NOTIONAL_USD
              - name: COINGECKO_URL
                valueFrom:
                  configMapKeyRef:
                    name: jobs
                    key: coingecko-url
              - name: COINGECKO_HEADER_KEY
                valueFrom:
                  configMapKeyRef:
                    name: jobs
                    key: coingecko-header-key
              - name: COINGECKO_API_KEY
                valueFrom:
                  secretKeyRef:
                    name: jobs
                    key: coingecko-api-key
              - name: NOTIONAL_CHANNEL
                value: {{ .NOTIONAL_CHANNEL }}
              - name: CACHE_URL
                valueFrom:
                  configMapKeyRef:
                    name: config
                    key: redis-uri
              - name: CACHE_PREFIX
                valueFrom:
                  configMapKeyRef:
                    name: config
                    key: redis-prefix
              - name: AWS_REGION
                valueFrom:
                  configMapKeyRef:
                    name: jobs
                    key: aws-region
              - name: AWS_BUCKET
                valueFrom:
                  configMapKeyRef:
                    name: jobs
                    key: aws-bucket
          restartPolicy: OnFailure
