building a sidecar to watch the blacklisted file
This commit is contained in:
@@ -21,6 +21,8 @@ spec:
|
|||||||
app: reverse-proxy
|
app: reverse-proxy
|
||||||
spec:
|
spec:
|
||||||
nodeName: kube-master
|
nodeName: kube-master
|
||||||
|
# Allows the sidecar to see and signal the Nginx process
|
||||||
|
shareProcessNamespace: true
|
||||||
containers:
|
containers:
|
||||||
#- image: nginx:alpine
|
#- image: nginx:alpine
|
||||||
- image: gitea.tryton.geeraert.eu/pi-ux-ce/geoip2-nginx:1.29.6
|
- image: gitea.tryton.geeraert.eu/pi-ux-ce/geoip2-nginx:1.29.6
|
||||||
@@ -56,6 +58,23 @@ spec:
|
|||||||
limits:
|
limits:
|
||||||
cpu: 250m
|
cpu: 250m
|
||||||
memory: 250Mi
|
memory: 250Mi
|
||||||
|
- name: sidecar-watcher
|
||||||
|
image: alpine:latest
|
||||||
|
command: ["/bin/sh", "-c"]
|
||||||
|
args:
|
||||||
|
- |
|
||||||
|
apk add --no-cache inotify-tools;
|
||||||
|
echo "Watcher started..."
|
||||||
|
while inotifywait -e close_write /etc/nginx/blacklisted.d/blacklisted-sessions.conf; do
|
||||||
|
echo "Change detected in deny.conf, reloading Nginx..."
|
||||||
|
# Find the Nginx master process and send SIGHUP (reload)
|
||||||
|
pkill -HUP nginx
|
||||||
|
done
|
||||||
|
volumeMounts:
|
||||||
|
- name: blacklisted-sessions-map
|
||||||
|
mountPath: /etc/nginx/blacklisted.d/
|
||||||
|
|
||||||
|
|
||||||
volumes:
|
volumes:
|
||||||
- name: reverse-proxy-log
|
- name: reverse-proxy-log
|
||||||
persistentVolumeClaim:
|
persistentVolumeClaim:
|
||||||
|
|||||||
Reference in New Issue
Block a user