apiVersion: batch/v1
kind: CronJob
metadata:
  name: protocols-stats-daily
  namespace: {{ .NAMESPACE }}
spec: #cronjob specs
  schedule: "0 0 * * *"
  jobTemplate:
    spec: # job specs
      template:
        spec: # pod specs
          containers:
            - name: protocols-stats-daily
              image: {{ .IMAGE_NAME }}
              imagePullPolicy: Always
              env:
                - name: ENVIRONMENT
                  value: {{ .ENVIRONMENT }}
                - name: LOG_LEVEL
                  value: {{ .LOG_LEVEL }}
                - name: JOB_ID
                  value: JOB_PROTOCOLS_STATS_DAILY
                - name: INFLUX_URL
                  valueFrom:
                    configMapKeyRef:
                      name: config
                      key: influxdb-url
                - name: INFLUX_TOKEN
                  valueFrom:
                    secretKeyRef:
                      name: influxdb
                      key: token
                - name: INFLUX_ORGANIZATION
                  valueFrom:
                    configMapKeyRef:
                      name: config
                      key: influxdb-organization
                - name: INFLUX_BUCKET_INFINITE
                  valueFrom:
                    configMapKeyRef:
                      name: config
                      key: influxdb-bucket-infinite
                - name: PROTOCOLS_JSON
                  value: {{ .PROTOCOLS_JSON }}
          restartPolicy: OnFailure