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