# services/monitoring/platform-quality-suite-probe-cronjob.yaml
apiVersion: batch/v1
kind: CronJob
metadata:
  name: platform-quality-suite-probe
  namespace: monitoring
spec:
  schedule: "*/15 * * * *"
  concurrencyPolicy: Forbid
  successfulJobsHistoryLimit: 2
  failedJobsHistoryLimit: 2
  jobTemplate:
    spec:
      backoffLimit: 0
      template:
        metadata:
          labels:
            app: platform-quality-suite-probe
        spec:
          restartPolicy: Never
          nodeSelector:
            node-role.kubernetes.io/worker: "true"
          affinity:
            nodeAffinity:
              requiredDuringSchedulingIgnoredDuringExecution:
                nodeSelectorTerms:
                  - matchExpressions:
                      - key: hardware
                        operator: In
                        values:
                          - rpi5
                          - rpi4
          containers:
            - name: probe
              image: curlimages/curl:8.12.1
              imagePullPolicy: IfNotPresent
              resources:
                requests:
                  cpu: 10m
                  memory: 32Mi
                limits:
                  cpu: 100m
                  memory: 128Mi
              command: ["/bin/sh", "/scripts/platform_quality_suite_probe.sh"]
              env:
                - name: PUSHGATEWAY_URL
                  value: http://platform-quality-gateway.monitoring.svc.cluster.local:9091
                - name: HTTP_TIMEOUT_SECONDS
                  value: "12"
              volumeMounts:
                - name: probe-script
                  mountPath: /scripts
                  readOnly: true
          volumes:
            - name: probe-script
              configMap:
                name: platform-quality-suite-probe-script
                defaultMode: 0555
