Skip to content

Commit e27d71c

Browse files
authored
Update monitoring stack to SDP 25.7 and scrape all products (#284)
1 parent d7fa9c9 commit e27d71c

7 files changed

+6015
-2954
lines changed

stacks/_templates/prometheus-service-monitor.yaml

Lines changed: 0 additions & 39 deletions
This file was deleted.
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
---
2+
apiVersion: v1
3+
kind: ServiceAccount
4+
metadata:
5+
name: create-prometheus-tls-certificate-serviceaccount
6+
---
7+
apiVersion: rbac.authorization.k8s.io/v1
8+
kind: RoleBinding
9+
metadata:
10+
name: create-prometheus-tls-certificate-rolebinding
11+
subjects:
12+
- kind: ServiceAccount
13+
name: create-prometheus-tls-certificate-serviceaccount
14+
namespace: {{ NAMESPACE }}
15+
roleRef:
16+
kind: Role
17+
name: create-prometheus-tls-certificate-role
18+
apiGroup: rbac.authorization.k8s.io
19+
---
20+
apiVersion: rbac.authorization.k8s.io/v1
21+
kind: Role
22+
metadata:
23+
name: create-prometheus-tls-certificate-role
24+
rules:
25+
- apiGroups: [""]
26+
resources: ["secrets"]
27+
verbs: ["get", "create", "patch"]
28+
- apiGroups: [""]
29+
resources: ["pods"]
30+
verbs: ["delete"]
Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
---
2+
apiVersion: apps/v1
3+
kind: Deployment
4+
metadata:
5+
name: create-prometheus-tls-certificate
6+
labels:
7+
app: create-prometheus-tls-certificate
8+
spec:
9+
replicas: 1
10+
selector:
11+
matchLabels:
12+
app: create-prometheus-tls-certificate
13+
template:
14+
metadata:
15+
labels:
16+
app: create-prometheus-tls-certificate
17+
spec:
18+
serviceAccountName: create-prometheus-tls-certificate-serviceaccount
19+
containers:
20+
- name: create-prometheus-tls-certificate
21+
image: oci.stackable.tech/sdp/tools:1.0.0-stackable0.0.0-dev
22+
env:
23+
- name: POD_NAME
24+
valueFrom:
25+
fieldRef:
26+
fieldPath: metadata.name
27+
- name: POD_NAMESPACE
28+
valueFrom:
29+
fieldRef:
30+
fieldPath: metadata.namespace
31+
command:
32+
- bash
33+
- -euo
34+
- pipefail
35+
- -c
36+
- |
37+
# "kubectl create secret" fails on existing Secrets, so we "kubectl apply" instead
38+
kubectl create secret generic prometheus-tls-certificate \
39+
--from-file=/prometheus-tls-certificate/ca.crt \
40+
--from-file=/prometheus-tls-certificate/tls.crt \
41+
--from-file=/prometheus-tls-certificate/tls.key \
42+
--dry-run=client -o yaml \
43+
| kubectl apply -f -
44+
45+
echo Sleeping 6 hours before deleting my own Pod
46+
sleep 21600 # 6 * 60 * 60
47+
48+
echo "Deleting our own Pod, so that it gets re-created and secret-operator issues a new certificate (only crash-looping the container is not enough!)"
49+
kubectl --namespace "$POD_NAMESPACE" delete pod "$POD_NAME"
50+
exit 0
51+
volumeMounts:
52+
- name: prometheus-tls-certificate
53+
mountPath: /prometheus-tls-certificate
54+
volumes:
55+
- name: prometheus-tls-certificate
56+
ephemeral:
57+
volumeClaimTemplate:
58+
metadata:
59+
annotations:
60+
# Highly professional tests have shown that Prometheus is able to handle the
61+
# certificate rotation :)
62+
# You can change the certificate lifetime here for easier testing:
63+
# secrets.stackable.tech/backend.autotls.cert.lifetime: "1d"
64+
secrets.stackable.tech/class: "tls"
65+
secrets.stackable.tech/format: "tls-pem"
66+
secrets.stackable.tech/scope: "service=prometheus"
67+
spec:
68+
accessModes:
69+
- ReadWriteOnce
70+
resources:
71+
requests:
72+
storage: "1"
73+
storageClassName: secrets.stackable.tech
74+
volumeMode: Filesystem
75+
securityContext:
76+
fsGroup: 1000

0 commit comments

Comments
 (0)