Skip to content

Commit ca906b2

Browse files
author
Francesco Murdaca
authored
Introduce graph-metrics-exporter Cronjob (#1719)
* Introduce graph-metrics-exporter CF Signed-off-by: Francesco Murdaca <[email protected]>
1 parent 530c5bb commit ca906b2

18 files changed

+436
-0
lines changed
+94
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
---
2+
kind: CronJob
3+
apiVersion: batch/v1beta1
4+
metadata:
5+
name: graph-metrics-exporter
6+
labels:
7+
app: thoth
8+
component: graph-metrics-exporter
9+
spec:
10+
schedule: "@hourly"
11+
suspend: true
12+
concurrencyPolicy: Forbid
13+
successfulJobsHistoryLimit: 1
14+
failedJobsHistoryLimit: 1
15+
jobTemplate:
16+
spec:
17+
template:
18+
metadata:
19+
labels:
20+
app: thoth
21+
component: graph-metrics-exporter
22+
spec:
23+
containers:
24+
- image: graph-metrics-exporter:latest
25+
name: graph-metrics-exporter
26+
env:
27+
- name: THOTH_DEPLOYMENT_NAME
28+
valueFrom:
29+
configMapKeyRef:
30+
key: deployment-name
31+
name: thoth
32+
- name: PROMETHEUS_PUSHGATEWAY_URL
33+
valueFrom:
34+
configMapKeyRef:
35+
name: prometheus
36+
key: pushgateway-url
37+
- name: KNOWLEDGE_GRAPH_HOST
38+
valueFrom:
39+
configMapKeyRef:
40+
key: postgresql-host
41+
name: thoth
42+
- name: KNOWLEDGE_GRAPH_PORT
43+
value: "5432"
44+
- name: KNOWLEDGE_GRAPH_SSL_DISABLED
45+
value: "1"
46+
- name: KNOWLEDGE_GRAPH_USER
47+
valueFrom:
48+
secretKeyRef:
49+
name: postgresql
50+
key: database-user
51+
- name: KNOWLEDGE_GRAPH_PASSWORD
52+
valueFrom:
53+
secretKeyRef:
54+
name: postgresql
55+
key: database-password
56+
- name: KNOWLEDGE_GRAPH_DATABASE
57+
valueFrom:
58+
secretKeyRef:
59+
name: postgresql
60+
key: database-name
61+
- name: THOTH_LOGGING_NO_JSON
62+
valueFrom:
63+
configMapKeyRef:
64+
name: thoth
65+
key: logging-no-json
66+
- name: RSYSLOG_HOST
67+
valueFrom:
68+
configMapKeyRef:
69+
key: rsyslog-host
70+
name: thoth
71+
- name: RSYSLOG_PORT
72+
valueFrom:
73+
configMapKeyRef:
74+
key: rsyslog-port
75+
name: thoth
76+
- name: SENTRY_DSN
77+
valueFrom:
78+
secretKeyRef:
79+
name: thoth
80+
key: sentry-dsn
81+
resources:
82+
requests:
83+
memory: "256Mi"
84+
cpu: "500m"
85+
limits:
86+
memory: "256Mi"
87+
cpu: "500m"
88+
livenessProbe:
89+
tcpSocket:
90+
port: 80
91+
initialDelaySeconds: 7200
92+
failureThreshold: 1
93+
periodSeconds: 10
94+
restartPolicy: OnFailure
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
---
2+
apiVersion: image.openshift.io/v1
3+
kind: ImageStream
4+
metadata:
5+
name: graph-metrics-exporter
6+
spec:
7+
lookupPolicy:
8+
local: true
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
2+
apiVersion: kustomize.config.k8s.io/v1beta1
3+
kind: Kustomization
4+
resources:
5+
- cronjob.yaml
6+
- imagestream.yaml
7+
generatorOptions:
8+
disableNameSuffixHash: true
9+
commonLabels:
10+
app: thoth
11+
component: graph-metrics-exporter
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
kind: CronJob
3+
apiVersion: batch/v1beta1
4+
metadata:
5+
name: graph-metrics-exporter
6+
spec:
7+
suspend: false
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
apiVersion: image.openshift.io/v1
2+
kind: ImageStream
3+
metadata:
4+
name: graph-metrics-exporter
5+
spec:
6+
tags:
7+
- name: latest
8+
from:
9+
kind: DockerImage
10+
name: quay.io/thoth-station/graph-metrics-exporter:v0.4.1
11+
importPolicy: {}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
- op: move
2+
from: /metadata/name
3+
path: /metadata/generateName
4+
- op: add
5+
path: /metadata/namespace
6+
value: "thoth-infra-prod"
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
apiVersion: kustomize.config.k8s.io/v1beta1
2+
kind: Kustomization
3+
resources:
4+
- ../../base
5+
- thoth-notification.yaml
6+
patchesStrategicMerge:
7+
- cronjob.yaml
8+
- imagestreamtag.yaml
9+
patchesJson6902:
10+
- path: job-generate-name.yaml
11+
target:
12+
group: batch
13+
version: v1
14+
kind: Job
15+
name: chat-notification-success-
16+
- path: job-generate-name.yaml
17+
target:
18+
group: batch
19+
version: v1
20+
kind: Job
21+
name: chat-notification-fail-
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
---
2+
apiVersion: batch/v1
3+
kind: Job
4+
metadata:
5+
name: chat-notification-success-
6+
annotations:
7+
argocd.argoproj.io/hook: PostSync
8+
argocd.argoproj.io/hook-delete-policy: HookSucceeded
9+
spec:
10+
template:
11+
spec:
12+
containers:
13+
- name: chat-notification
14+
image: registry.access.redhat.com/ubi8/ubi
15+
command:
16+
- "curl"
17+
- "-X"
18+
- "POST"
19+
- "-H"
20+
- "Content-Type: application/json; charset=UTF-8"
21+
- "-d"
22+
- "{'text':'I have successfully synchronized *graph-metrics-exporter* components to *CNV-PROD*, see <https://argocd-server-argocd.apps.moc-infra.massopen.cloud/applications/prod-thoth-graph-metrics-exporter|ArgoCD UI>'}"
23+
- "$(THOTH_DEVOPS_WEBHOOK_URL)"
24+
env:
25+
- name: THOTH_DEVOPS_WEBHOOK_URL
26+
valueFrom:
27+
secretKeyRef:
28+
name: chat-notification
29+
key: thoth-devops
30+
restartPolicy: Never
31+
backoffLimit: 2
32+
---
33+
apiVersion: batch/v1
34+
kind: Job
35+
metadata:
36+
name: chat-notification-fail-
37+
annotations:
38+
argocd.argoproj.io/hook: SyncFail
39+
argocd.argoproj.io/hook-delete-policy: HookSucceeded
40+
spec:
41+
template:
42+
spec:
43+
containers:
44+
- name: chat-notification
45+
image: registry.access.redhat.com/ubi8/ubi
46+
command:
47+
- "curl"
48+
- "-X"
49+
- "POST"
50+
- "-H"
51+
- "Content-Type: application/json; charset=UTF-8"
52+
- "-d"
53+
- "{'text':'🔥 *FAIL* synchronizing *graph-metrics-exporter* components to *CNV-PROD*, see <https://argocd-server-argocd.apps.moc-infra.massopen.cloud/applications/prod-thoth-graph-metrics-exporter|ArgoCD UI>'}"
54+
- "$(THOTH_DEVOPS_WEBHOOK_URL)"
55+
env:
56+
- name: THOTH_DEVOPS_WEBHOOK_URL
57+
valueFrom:
58+
secretKeyRef:
59+
name: chat-notification
60+
key: thoth-devops
61+
restartPolicy: Never
62+
backoffLimit: 2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
kind: CronJob
3+
apiVersion: batch/v1beta1
4+
metadata:
5+
name: graph-metrics-exporter
6+
spec:
7+
suspend: false
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
apiVersion: image.openshift.io/v1
2+
kind: ImageStream
3+
metadata:
4+
name: graph-metrics-exporter
5+
spec:
6+
tags:
7+
- name: latest
8+
from:
9+
kind: DockerImage
10+
name: quay.io/thoth-station/graph-metrics-exporter:v0.4.1
11+
importPolicy: {}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
- op: move
2+
from: /metadata/name
3+
path: /metadata/generateName
4+
- op: add
5+
path: /metadata/namespace
6+
value: "thoth-infra-stage"
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
apiVersion: kustomize.config.k8s.io/v1beta1
2+
kind: Kustomization
3+
resources:
4+
- ../../base
5+
- thoth-notification.yaml
6+
patchesStrategicMerge:
7+
- cronjob.yaml
8+
- imagestreamtag.yaml
9+
patchesJson6902:
10+
- path: job-generate-name.yaml
11+
target:
12+
group: batch
13+
version: v1
14+
kind: Job
15+
name: chat-notification-success-
16+
- path: job-generate-name.yaml
17+
target:
18+
group: batch
19+
version: v1
20+
kind: Job
21+
name: chat-notification-fail-
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
---
2+
apiVersion: batch/v1
3+
kind: Job
4+
metadata:
5+
name: chat-notification-success-
6+
annotations:
7+
argocd.argoproj.io/hook: PostSync
8+
argocd.argoproj.io/hook-delete-policy: HookSucceeded
9+
spec:
10+
template:
11+
spec:
12+
containers:
13+
- name: chat-notification
14+
image: registry.access.redhat.com/ubi8/ubi
15+
command:
16+
- "curl"
17+
- "-X"
18+
- "POST"
19+
- "-H"
20+
- "Content-Type: application/json; charset=UTF-8"
21+
- "-d"
22+
- "{'text':'I have successfully synchronized *graph-metrics-exporter* components to *OCP4-STAGE*, see <https://argocd-server-aicoe-argocd.apps.ocp4.prod.psi.redhat.com/applications/stage-thoth-graph-metrics-exporter|ArgoCD UI>'}"
23+
- "$(THOTH_DEVOPS_WEBHOOK_URL)"
24+
env:
25+
- name: THOTH_DEVOPS_WEBHOOK_URL
26+
valueFrom:
27+
secretKeyRef:
28+
name: chat-notification
29+
key: thoth-devops
30+
restartPolicy: Never
31+
backoffLimit: 2
32+
---
33+
apiVersion: batch/v1
34+
kind: Job
35+
metadata:
36+
name: chat-notification-fail-
37+
annotations:
38+
argocd.argoproj.io/hook: SyncFail
39+
argocd.argoproj.io/hook-delete-policy: HookSucceeded
40+
spec:
41+
template:
42+
spec:
43+
containers:
44+
- name: chat-notification
45+
image: registry.access.redhat.com/ubi8/ubi
46+
command:
47+
- "curl"
48+
- "-X"
49+
- "POST"
50+
- "-H"
51+
- "Content-Type: application/json; charset=UTF-8"
52+
- "-d"
53+
- "{'text':'🔥 *FAIL* synchronizing *graph-metrics-exporter* components to *OCP4-STAGE*, see <https://argocd-server-aicoe-argocd.apps.ocp4.prod.psi.redhat.com/applications/stage-thoth-graph-metrics-exporter|ArgoCD UI>'}"
54+
- "$(THOTH_DEVOPS_WEBHOOK_URL)"
55+
env:
56+
- name: THOTH_DEVOPS_WEBHOOK_URL
57+
valueFrom:
58+
secretKeyRef:
59+
name: chat-notification
60+
key: thoth-devops
61+
restartPolicy: Never
62+
backoffLimit: 2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
kind: CronJob
3+
apiVersion: batch/v1beta1
4+
metadata:
5+
name: graph-metrics-exporter
6+
spec:
7+
suspend: false
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
apiVersion: image.openshift.io/v1
2+
kind: ImageStream
3+
metadata:
4+
name: graph-metrics-exporter
5+
spec:
6+
tags:
7+
- name: latest
8+
from:
9+
kind: DockerImage
10+
name: quay.io/thoth-station/graph-metrics-exporter:v0.4.1
11+
importPolicy: {}
12+
referencePolicy:
13+
type: Source
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
- op: move
2+
from: /metadata/name
3+
path: /metadata/generateName
4+
- op: add
5+
path: /metadata/namespace
6+
value: "thoth-test-core"
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
apiVersion: kustomize.config.k8s.io/v1beta1
2+
kind: Kustomization
3+
resources:
4+
- ../../base
5+
- thoth-notification.yaml
6+
patchesStrategicMerge:
7+
- cronjob.yaml
8+
- imagestreamtag.yaml
9+
patchesJson6902:
10+
- path: job-generate-name.yaml
11+
target:
12+
group: batch
13+
version: v1
14+
kind: Job
15+
name: chat-notification-success-
16+
- path: job-generate-name.yaml
17+
target:
18+
group: batch
19+
version: v1
20+
kind: Job
21+
name: chat-notification-fail-

0 commit comments

Comments
 (0)