watcher struggling

This commit is contained in:
2026-07-30 11:02:29 +01:00
parent 93f8d41aac
commit 9349bc5122
+30 -30
View File
@@ -4,8 +4,8 @@ metadata:
name: reverse-proxy
---
apiVersion: apps/v1
#kind: Deployment
kind: DaemonSet
kind: Deployment
#kind: DaemonSet
metadata:
name: reverse-proxy
namespace: reverse-proxy
@@ -21,9 +21,9 @@ spec:
labels:
app: reverse-proxy
spec:
hostNetwork: true
dnsPolicy: ClusterFirstWithHostNet # required when hostNetwork: true
#nodeName: kube-master
#hostNetwork: true
#dnsPolicy: ClusterFirstWithHostNet # required when hostNetwork: true
nodeName: kube-master
# Allows the sidecar to see and signal the Nginx process
shareProcessNamespace: true
containers:
@@ -67,27 +67,27 @@ spec:
cpu: 250m
memory: 250Mi
- name: watcher
image: alpine:latest
command: ["/bin/sh", "-c"]
args:
- |
# - name: watcher
# image: alpine:latest
# command: ["/bin/sh", "-c"]
# args:
# - |#
apk add --no-cache inotify-tools;
# Ensure file exists so inotify doesn't fail
touch /etc/nginx/blacklisted.d/blacklisted-sessions.conf;
echo "Watcher started on /etc/nginx/blacklisted.d/blacklisted-sessions.conf"
# apk add --no-cache inotify-tools;
# # Ensure file exists so inotify doesn't fail
# touch /etc/nginx/blacklisted.d/blacklisted-sessions.conf;
# echo "Watcher started on /etc/nginx/blacklisted.d/blacklisted-sessions.conf"
while inotifywait -e modify /etc/nginx/blacklisted.d/blacklisted-sessions.conf; do
echo "Change detected, waiting 5 seconds to batch updates..."
sleep 5;
# while inotifywait -e modify /etc/nginx/blacklisted.d/blacklisted-sessions.conf; do
# echo "Change detected, waiting 5 seconds to batch updates..."
# sleep 5;
# Check if Nginx is actually running before signaling
if pgrep nginx > /dev/null; then
echo "Reloading Nginx..."
pkill -HUP nginx
fi
done
# # Check if Nginx is actually running before signaling
# if pgrep nginx > /dev/null; then
# echo "Reloading Nginx..."
# pkill -HUP nginx
# fi
# done
volumeMounts:
- name: blacklisted-memory-volume
@@ -95,12 +95,12 @@ spec:
tolerations:
# these tolerations are to have the daemonset runnable on control plane nodes
# remove them if your control plane nodes should not run pods
- key: node-role.kubernetes.io/control-plane
operator: Exists
effect: NoSchedule
- key: node-role.kubernetes.io/master
operator: Exists
effect: NoSchedule
#- key: node-role.kubernetes.io/control-plane
# operator: Exists
# effect: NoSchedule
#- key: node-role.kubernetes.io/master
# operator: Exists
# effect: NoSchedule
volumes:
- name: reverse-proxy-log
@@ -193,6 +193,6 @@ spec:
type: LoadBalancer
externalTrafficPolicy: Local
#externalTrafficPolicy: Local
selector:
app: reverse-proxy