---
  kind: "CronJob"
  apiVersion: "batch/v1beta1"
  metadata:
    name: "pd-pipeline-metrics-hourly"
    namespace: "metrics-tools"
    labels:
      app.kubernetes.io/name: "pd-pipeline-metrics-hourly"
  spec:
    schedule: "30 * * * *"
    startingDeadlineSeconds: 10
    concurrencyPolicy: "Forbid"
    suspend: false
    jobTemplate:
      metadata:
        creationTimestamp: null
        labels:
          app.kubernetes.io/name: "pd-pipeline-metrics-hourly"
      spec:
        template:
          metadata:
            creationTimestamp: null
          spec:
            containers:
              -
                name: "pd-pipeline-metrics-hourly"
                image: "docker-registry.zooxlabs.com/pipeline_metrics-hourly:2"
                command:
                  - "bash"
                args:
                  - "-c"
                  # Script uses --weekly to gather 1 week of data to perform this operation
                  - "python3 get_pd_elk_metrics.py --weekly --pd_metrics --es_url https://search-metrics-production-c65mdhdibmbmkl4pfiqsj5yhmq.us-west-2.es.amazonaws.com:443"
                workingDir: "/opt/zoox"
                env:
                  -
                    name: "AWS_ACCESS_KEY_ID"
                    valueFrom:
                      secretKeyRef:
                        name: "mwurtz-aws-ro-creds"
                        key: "aws_access_key_id"
                  -
                    name: "AWS_SECRET_ACCESS_KEY"
                    valueFrom:
                      secretKeyRef:
                        name: "mwurtz-aws-ro-creds"
                        key: "aws_secret_access_key"
                  -
                    name: "SLACK_WEBHOOK_URL"
                    valueFrom:
                      secretKeyRef:
                        name: "slack-webhook-sre"
                        key: "webhook_url"
                  -
                    name: "AWS_DEFAULT_REGION"
                    value: "us-west-1"
                resources: {}
                terminationMessagePath: "/dev/termination-log"
                terminationMessagePolicy: "File"
                imagePullPolicy: "Always"
            restartPolicy: "Never"
            terminationGracePeriodSeconds: 30
            dnsPolicy: "ClusterFirst"
            securityContext: {}
            schedulerName: "default-scheduler"
    successfulJobsHistoryLimit: 3
    failedJobsHistoryLimit: 1
