Skip to content

Commit 5940853

Browse files
Merge pull request #18391 from aweiteka/prometheus-reload
Automatic merge from submit-queue (batch tested with PRs 18780, 18802, 18391, 18832, 18808). Prometheus config reload livenessprobe Use case: config updated via configmap. When the change lands in the container (~60 seconds delay) the config directory hash changes and the process is killed. This does not kill the pod but results in a silent reload of config with a corresponding metric timestamp, `prometheus_config_last_reload_success_timestamp_seconds`. Signed-off-by: Aaron Weitekamp <[email protected]>
2 parents 354949f + 058c982 commit 5940853

File tree

3 files changed

+42
-0
lines changed

3 files changed

+42
-0
lines changed

examples/prometheus/prometheus.yaml

+14
Original file line numberDiff line numberDiff line change
@@ -283,6 +283,20 @@ objects:
283283
- --web.listen-address=localhost:9090
284284
image: ${IMAGE_PROMETHEUS}
285285
imagePullPolicy: IfNotPresent
286+
livenessProbe:
287+
exec:
288+
command:
289+
- /bin/bash
290+
- -c
291+
- |-
292+
set -euo pipefail;
293+
touch /tmp/prometheusconfig.hash;
294+
if [[ $(find /etc/prometheus -type f | sort | xargs md5sum | md5sum) != $(cat /tmp/prometheusconfig.hash) ]]; then
295+
find /etc/prometheus -type f | sort | xargs md5sum | md5sum > /tmp/prometheusconfig.hash;
296+
kill -HUP 1;
297+
fi
298+
initialDelaySeconds: 60
299+
periodSeconds: 60
286300
volumeMounts:
287301
- mountPath: /etc/prometheus
288302
name: prometheus-config

pkg/oc/bootstrap/bindata.go

+14
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

test/extended/testdata/bindata.go

+14
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)