Merge "Add haproxy startup script"
This commit is contained in:
20
promenade/templates/roles/common/usr/local/bin/haproxy
Executable file
20
promenade/templates/roles/common/usr/local/bin/haproxy
Executable file
@@ -0,0 +1,20 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -exuo pipefail
|
||||
|
||||
IMAGE_HAPROXY="{{ config['HostSystem:images.haproxy'] }}"
|
||||
|
||||
while true; do
|
||||
if systemctl is-active kubelet && [[ -e /etc/kubernetes/manifests/haproxy.yaml ]]; then
|
||||
if docker ps | grep -q haproxy; then
|
||||
docker stop -t 10 haproxy
|
||||
fi
|
||||
break
|
||||
else
|
||||
if ! docker ps | grep -q haproxy; then
|
||||
docker run --rm -d --net host -v /etc/promenade/haproxy:/usr/local/etc/haproxy:ro \
|
||||
--name haproxy "$IMAGE_HAPROXY"
|
||||
fi
|
||||
sleep 5
|
||||
fi
|
||||
done
|
Reference in New Issue
Block a user