apiVersion: batch/v1beta1
kind: CronJob
metadata:
  name: prometheus-exporter-weather
  labels:
    app: prometheus-exporter-weather
spec:
  schedule: 0 * * * *
  jobTemplate:
    spec:
      template:
        spec:
          imagePullSecrets:
          - name: registry
          containers:
          - image: ghcr.io/davidsbond/homelab:latest
            imagePullPolicy: IfNotPresent
            name: prometheus-exporter-weather
            command:
            - /bin/prometheus-exporter-weather
            env:
            - name: TRACER_HOST
              valueFrom:
                configMapKeyRef:
                  key: tracer.host
                  name: tracing
            - name: METRICS_PUSH_URL
              valueFrom:
                configMapKeyRef:
                  key: push.gateway.url
                  name: prometheus
            - name: API_KEY
              valueFrom:
                secretKeyRef:
                  name: weather
                  key: weather.api.key
            - name: LOCATION
              valueFrom:
                secretKeyRef:
                  name: weather
                  key: weather.location
            - name: MONITORING_DSN
              valueFrom:
                secretKeyRef:
                  key: sentry.dsn
                  name: sentry
            readinessProbe:
              httpGet:
                path: /__/health
                port: 8081
              initialDelaySeconds: 5
          restartPolicy: OnFailure
