Skip to content

Commit

Permalink
Issue #86 remove VIP upon stop - haproxy-keepalived
Browse files Browse the repository at this point in the history
  • Loading branch information
instantlinux committed Aug 22, 2023
1 parent e971c64 commit 453cb67
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 4 deletions.
2 changes: 1 addition & 1 deletion images/haproxy-keepalived/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM haproxy:2.8.1-alpine
FROM haproxy:2.8.2-alpine
MAINTAINER Rich Braun "[email protected]"
ARG BUILD_DATE
ARG VCS_REF
Expand Down
1 change: 1 addition & 0 deletions images/haproxy-keepalived/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ services:
environment:
KEEPALIVE_CONFIG_ID: ${KEEPALIVED_CONFIG_ID:-main}
TZ: ${TZ:-UTC}
stop_signal: SIGTERM
volumes:
- ${ADMIN_PATH:-/opt}/haproxy/etc:/usr/local/etc/haproxy.d:ro
- ${ADMIN_PATH:-/opt}/keepalived/etc/keepalived.conf:/etc/keepalived/keepalived.conf:ro
Expand Down
11 changes: 10 additions & 1 deletion images/haproxy-keepalived/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
#!/bin/sh -e

function graceful_stop() {
echo "Received SIGTERM"
kill -SIGTERM $(cat /run/keepalived/*.pid)
exit 0
}

if [ -s /run/secrets/$STATS_SECRET ]; then
STATS_PASSWORD=$(cat /run/secrets/$STATS_SECRET)
else
Expand Down Expand Up @@ -60,6 +66,9 @@ rm -f /run/rsyslogd.pid && rsyslogd
if ! keepalived -i $KEEPALIVE_CONFIG_ID; then
echo keepalived did not start, needs working /etc/keepalived/keepalived.conf
fi
trap graceful_stop SIGTERM

sleep 10
haproxy -f $HAPROXY_PATH/haproxy.cfg $CMD_OPTS || true
tail +1 -f /var/log/messages
tail +1 -f /var/log/messages &
wait
4 changes: 2 additions & 2 deletions images/haproxy-keepalived/helm/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ sources:
- https://github.com/haproxy/haproxy
- https://github.com/acassen/keepalived
type: application
version: 0.1.11
appVersion: "2.8.1-alpine-2.2.8-r0"
version: 0.1.12
appVersion: "2.8.2-alpine-2.2.8-r0"
dependencies:
- name: chartlib
version: 0.1.8
Expand Down

0 comments on commit 453cb67

Please sign in to comment.