Merge "Move keepalived common files to common dir"
This commit is contained in:
commit
9f3d98dcec
@ -1,7 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
# This is noop check script. Change it to something meaningful.
|
||||
# TODO (inc0): When HAProxy is implemented, this should be changed to HAProxy check
|
||||
# https://github.com/stackforge/kolla/blob/master/specs/high-availability.rst
|
||||
|
||||
exit 0
|
1
docker/centos/binary/keepalived/check_alive.sh
Symbolic link
1
docker/centos/binary/keepalived/check_alive.sh
Symbolic link
@ -0,0 +1 @@
|
||||
../../../common/keepalived/check_alive.sh
|
@ -1,19 +0,0 @@
|
||||
vrrp_script check_alive {
|
||||
script "/check_alive.sh"
|
||||
interval 2
|
||||
weight -10
|
||||
}
|
||||
|
||||
vrrp_instance Floating {
|
||||
state MASTER
|
||||
interface @PUBLIC_INTERFACE@
|
||||
virtual_router_id 51
|
||||
priority @KEEPALIVED_PRIORITY@
|
||||
advert_int 1
|
||||
virtual_ipaddress {
|
||||
@PUBLIC_IP@
|
||||
}
|
||||
track_script {
|
||||
check_alive
|
||||
}
|
||||
}
|
1
docker/centos/binary/keepalived/keepalived.conf
Symbolic link
1
docker/centos/binary/keepalived/keepalived.conf
Symbolic link
@ -0,0 +1 @@
|
||||
../../../common/keepalived/keepalived.conf
|
@ -1,29 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
. /opt/kolla/kolla-common.sh
|
||||
|
||||
check_required_vars KEEPALIVED_HOST_PRIORITIES PUBLIC_IP PUBLIC_INTERFACE
|
||||
|
||||
MY_HOSTNAME=`hostname`
|
||||
|
||||
# here we unpack KEEPALIVED_HOST_PRIORITIES hostname:priority pairs and match
|
||||
# them with current hostname, if it's there
|
||||
for i in ${KEEPALIVED_HOST_PRIORITIES//,/ }; do
|
||||
HOST_PRIORITY=(${i//:/ })
|
||||
if [ "$MY_HOSTNAME" == "${HOST_PRIORITY[0]}" ]; then
|
||||
KEEPALIVED_PRIORITY=${HOST_PRIORITY[1]}
|
||||
fi
|
||||
done
|
||||
|
||||
if [ -z "$KEEPALIVED_PRIORITY" ]; then
|
||||
echo "ERROR: missing hostname in KEEPALIVED_HOST_PRIORITIES: $MY_HOSTNAME" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
sed -i '
|
||||
s|@PUBLIC_INTERFACE@|'$PUBLIC_INTERFACE'|g
|
||||
s|@PUBLIC_IP@|'$PUBLIC_IP'|g
|
||||
s|@KEEPALIVED_PRIORITY@|'$KEEPALIVED_PRIORITY'|g
|
||||
' /etc/keepalived/keepalived.conf
|
||||
|
||||
exec /usr/sbin/keepalived -nld -p /run/keepalived.pid
|
1
docker/centos/binary/keepalived/start.sh
Symbolic link
1
docker/centos/binary/keepalived/start.sh
Symbolic link
@ -0,0 +1 @@
|
||||
../../../common/keepalived/start.sh
|
7
docker/common/keepalived/check_alive.sh
Executable file
7
docker/common/keepalived/check_alive.sh
Executable file
@ -0,0 +1,7 @@
|
||||
#!/bin/bash
|
||||
|
||||
# This is noop check script. Change it to something meaningful.
|
||||
# TODO (inc0): When HAProxy is implemented, this should be changed to HAProxy check
|
||||
# https://github.com/stackforge/kolla/blob/master/specs/high-availability.rst
|
||||
|
||||
exit 0
|
19
docker/common/keepalived/keepalived.conf
Executable file
19
docker/common/keepalived/keepalived.conf
Executable file
@ -0,0 +1,19 @@
|
||||
vrrp_script check_alive {
|
||||
script "/check_alive.sh"
|
||||
interval 2
|
||||
weight -10
|
||||
}
|
||||
|
||||
vrrp_instance Floating {
|
||||
state MASTER
|
||||
interface @PUBLIC_INTERFACE@
|
||||
virtual_router_id 51
|
||||
priority @KEEPALIVED_PRIORITY@
|
||||
advert_int 1
|
||||
virtual_ipaddress {
|
||||
@PUBLIC_IP@
|
||||
}
|
||||
track_script {
|
||||
check_alive
|
||||
}
|
||||
}
|
29
docker/common/keepalived/start.sh
Executable file
29
docker/common/keepalived/start.sh
Executable file
@ -0,0 +1,29 @@
|
||||
#!/bin/bash
|
||||
|
||||
. /opt/kolla/kolla-common.sh
|
||||
|
||||
check_required_vars KEEPALIVED_HOST_PRIORITIES PUBLIC_IP PUBLIC_INTERFACE
|
||||
|
||||
MY_HOSTNAME=`hostname`
|
||||
|
||||
# here we unpack KEEPALIVED_HOST_PRIORITIES hostname:priority pairs and match
|
||||
# them with current hostname, if it's there
|
||||
for i in ${KEEPALIVED_HOST_PRIORITIES//,/ }; do
|
||||
HOST_PRIORITY=(${i//:/ })
|
||||
if [ "$MY_HOSTNAME" == "${HOST_PRIORITY[0]}" ]; then
|
||||
KEEPALIVED_PRIORITY=${HOST_PRIORITY[1]}
|
||||
fi
|
||||
done
|
||||
|
||||
if [ -z "$KEEPALIVED_PRIORITY" ]; then
|
||||
echo "ERROR: missing hostname in KEEPALIVED_HOST_PRIORITIES: $MY_HOSTNAME" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
sed -i '
|
||||
s|@PUBLIC_INTERFACE@|'$PUBLIC_INTERFACE'|g
|
||||
s|@PUBLIC_IP@|'$PUBLIC_IP'|g
|
||||
s|@KEEPALIVED_PRIORITY@|'$KEEPALIVED_PRIORITY'|g
|
||||
' /etc/keepalived/keepalived.conf
|
||||
|
||||
exec /usr/sbin/keepalived -nld -p /run/keepalived.pid
|
Loading…
x
Reference in New Issue
Block a user