diff options
Diffstat (limited to 'docker/keepalived')
| -rw-r--r-- | docker/keepalived/Dockerfile.j2 | 26 | ||||
| -rwxr-xr-x | docker/keepalived/check_alive.sh | 6 | ||||
| -rwxr-xr-x | docker/keepalived/config-external.sh | 10 | ||||
| -rwxr-xr-x | docker/keepalived/start.sh | 20 |
4 files changed, 62 insertions, 0 deletions
diff --git a/docker/keepalived/Dockerfile.j2 b/docker/keepalived/Dockerfile.j2 new file mode 100644 index 000000000..325e4c2c5 --- /dev/null +++ b/docker/keepalived/Dockerfile.j2 @@ -0,0 +1,26 @@ +FROM {{ namespace }}/{{ base_distro }}-{{ install_type }}-base:{{ tag }} +MAINTAINER Kolla Project (https://launchpad.net/kolla) + +{% if base_distro in ['fedora', 'centos', 'oraclelinux'] %} + +RUN yum -y install \ + hostname \ + keepalived \ + socat \ + && yum clean all + +{% elif base_distro in ['ubuntu', 'debian'] %} + +RUN apt-get install -y --no-install-recommends \ + keepalived \ + socat \ + && apt-get clean + +{% endif %} + +COPY start.sh check_alive.sh / +COPY config-external.sh /opt/kolla/ + +CMD ["/start.sh"] + +{{ include_footer }} diff --git a/docker/keepalived/check_alive.sh b/docker/keepalived/check_alive.sh new file mode 100755 index 000000000..8c2684f10 --- /dev/null +++ b/docker/keepalived/check_alive.sh @@ -0,0 +1,6 @@ +#!/bin/bash + +# This will return 0 when it successfully talks to the haproxy daemon via the socket +# Failures return 1 + +echo "show info" | socat unix-connect:/run/haproxy.sock stdio diff --git a/docker/keepalived/config-external.sh b/docker/keepalived/config-external.sh new file mode 100755 index 000000000..d7ff97826 --- /dev/null +++ b/docker/keepalived/config-external.sh @@ -0,0 +1,10 @@ +#!/bin/bash +SOURCE="/opt/kolla/keepalived/keepalived.conf" +TARGET="/etc/keepalived/keepalived.conf" +OWNER="root" + +if [[ -f "$SOURCE" ]]; then + cp $SOURCE $TARGET + chown ${OWNER}: $TARGET + chmod 0644 $TARGET +fi diff --git a/docker/keepalived/start.sh b/docker/keepalived/start.sh new file mode 100755 index 000000000..a122526e4 --- /dev/null +++ b/docker/keepalived/start.sh @@ -0,0 +1,20 @@ +#!/bin/bash +set -o errexit + +CMD="/usr/sbin/keepalived" +ARGS="-nld -p /run/keepalived.pid" + +# Loading common functions. +source /opt/kolla/kolla-common.sh + +# Execute config strategy +set_configs + +modprobe ip_vs + +# Workaround for bug #1485079 +if [ -f /run/keepalived.pid ]; then + rm /run/keepalived.pid +fi + +exec $CMD $ARGS |
