diff --git a/k8s/base/daily-openshift-metrics-collector-cronjob.yaml b/k8s/base/daily-openshift-metrics-collector-cronjob.yaml new file mode 100644 index 0000000..2951e5d --- /dev/null +++ b/k8s/base/daily-openshift-metrics-collector-cronjob.yaml @@ -0,0 +1,39 @@ +apiVersion: batch/v1 +kind: CronJob +metadata: + name: daily-openshift-metrics-collector +spec: + schedule: "0 12 * * *" + jobTemplate: + spec: + template: + spec: + containers: + - name: daily-openshift-metrics-collector + image: ghcr.io/cci-moc/openshift-usage-scripts:latest + env: + - name: OPENSHIFT_PROMETHEUS_URL + value: "https://thanos-querier-openshift-monitoring.apps.shift.nerc.mghpcc.org" + - name: OPENSHIFT_TOKEN + valueFrom: + secretKeyRef: + name: metrics-reader + key: token + - name: S3_OUTPUT_ACCESS_KEY_ID + valueFrom: + secretKeyRef: + name: openshift-metrics-b2-bucket + key: access-key-id + - name: S3_OUTPUT_SECRET_ACCESS_KEY + valueFrom: + secretKeyRef: + name: openshift-metrics-b2-bucket + key: secret-access-key + volumeMounts: + - name: data-volume + mountPath: /data + command: ["/bin/sh", "-c", "cd /data && python /app/openshift_metrics/openshift_prometheus_metrics.py --upload-to-s3"] + volumes: + - name: data-volume + emptyDir: {} + restartPolicy: OnFailure diff --git a/k8s/base/kustomization.yaml b/k8s/base/kustomization.yaml new file mode 100644 index 0000000..51ac1c8 --- /dev/null +++ b/k8s/base/kustomization.yaml @@ -0,0 +1,2 @@ +resources: + - daily-openshift-metrics-collector-cronjob.yaml diff --git a/k8s/overlay/dev/kustomization.yaml b/k8s/overlay/dev/kustomization.yaml new file mode 100644 index 0000000..78cb335 --- /dev/null +++ b/k8s/overlay/dev/kustomization.yaml @@ -0,0 +1,5 @@ +resources: + - ../../base + - openshift-metrics-b2-bucket.yaml + - metrics-reader-token.yaml +namespace: xdmod-reader diff --git a/k8s/overlay/dev/metrics-reader-token.yaml b/k8s/overlay/dev/metrics-reader-token.yaml new file mode 100644 index 0000000..ec38765 --- /dev/null +++ b/k8s/overlay/dev/metrics-reader-token.yaml @@ -0,0 +1,8 @@ +apiVersion: v1 +kind: Secret +metadata: + name: metrics-reader +type: Opaque +data: + token: + diff --git a/k8s/overlay/dev/openshift-metrics-b2-bucket.yaml b/k8s/overlay/dev/openshift-metrics-b2-bucket.yaml new file mode 100644 index 0000000..3c029c0 --- /dev/null +++ b/k8s/overlay/dev/openshift-metrics-b2-bucket.yaml @@ -0,0 +1,8 @@ +apiVersion: v1 +kind: Secret +metadata: + name: openshift-metrics-b2-bucket +type: Opaque +data: + access-key-id: 1234 + secret-access-key: secret