Last active
November 29, 2019 11:36
-
-
Save geberl/142e59a599e82815faddac087642c05c to your computer and use it in GitHub Desktop.
Watch Envoy's config files and use the required mv command to trigger a reload
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Install the inotify tools in Dockerfile: | |
# RUN apt-get update && apt-get install -y inotify-tools | |
# Then establish the watch in the Docker entrypoint.sh: | |
# ./inotify_watcher.sh & | |
inotifywait --monitor "/etc/envoy/k8s/" --event create --event modify --event moved_to | | |
while read path action file; do | |
# echo "File '$file', path '$path' -> '$action'" | |
if [[ "$file" = "..data" ]]; then | |
cp /etc/envoy/k8s/clusters.yaml /tmp/clusters.yaml || true | |
cp /etc/envoy/k8s/listeners.yaml /tmp/listeners.yaml || true | |
mv /tmp/clusters.yaml /etc/envoy/clusters.yaml || true | |
mv /tmp/listeners.yaml /etc/envoy/listeners.yaml || true | |
fi | |
done | |
# Warning: | |
# This does not work reliably, if listeners refer to clusters that don't exist yet the change is refused | |
# This script does not ensure that the clusters are loaded before the listeners |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment