---
apiVersion: batch/v1beta1
kind: CronJob
metadata:
  name: octopus-consumption-influxdb
spec:
  schedule: "0 0 * * *"
  jobTemplate:
    spec:
      template:
        spec:
          containers:
            - name: octopus-consumption-influxdb
              env:
                - name: CONFIG_PATH
                  value: /etc/config/meter-points.yaml
                - name: INFLUXDB_ADDRESS
                  value: http://influxdb.influxdb.svc.cluster.local:8086
                - name: INFLUXDB_DATABASE
                  value: octopus
                - name: INFLUXDB_USERNAME
                  value: influxdb
                - name: INFLUXDB_PASSWORD
                  value: influxdb
                - name: OCTOPUS_API_KEY
                  valueFrom:
                    secretKeyRef:
                      name: octopus-api-key
                      key: OCTOPUS_API_KEY
              image: ghcr.io/adtennant/octopus-consumption-influxdb:master
              imagePullPolicy: Always
              volumeMounts:
                - name: config
                  mountPath: /etc/config
          restartPolicy: OnFailure
          volumes:
            - name: config
              secret:
                secretName: meter-points
