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