diff options
| author | Jenkins <jenkins@review.openstack.org> | 2015-06-24 06:01:40 +0000 |
|---|---|---|
| committer | Gerrit Code Review <review@openstack.org> | 2015-06-24 06:01:40 +0000 |
| commit | 54aa5d2fd185ec290b545b7eac3366a320f4488d (patch) | |
| tree | c7212ab56cd9f7181af129f6a1f369abb2061b76 | |
| parent | 2336ba39d49b9a463ce627b1a8dbc3f3f866252d (diff) | |
| parent | 52f49094356ca70495e3bc606751d55104726881 (diff) | |
| download | kolla-54aa5d2fd185ec290b545b7eac3366a320f4488d.tar.gz kolla-54aa5d2fd185ec290b545b7eac3366a320f4488d.zip | |
Merge "Keepalived container"
| -rwxr-xr-x | compose/keepalived.yml | 8 | ||||
| -rwxr-xr-x | docker/centos/binary/keepalived/Dockerfile | 13 | ||||
| l--------- | docker/centos/binary/keepalived/build | 1 | ||||
| -rwxr-xr-x | docker/centos/binary/keepalived/check_alive.sh | 7 | ||||
| -rwxr-xr-x | docker/centos/binary/keepalived/keepalived.conf | 19 | ||||
| -rwxr-xr-x | docker/centos/binary/keepalived/start.sh | 29 | ||||
| -rwxr-xr-x[-rw-r--r--] | docs/integration-guide.md | 2 | ||||
| -rwxr-xr-x | tools/genenv | 6 |
8 files changed, 85 insertions, 0 deletions
diff --git a/compose/keepalived.yml b/compose/keepalived.yml new file mode 100755 index 000000000..11689e513 --- /dev/null +++ b/compose/keepalived.yml @@ -0,0 +1,8 @@ +keepalived: + image: kollaglue/centos-rdo-keepalived:latest + name: keepalived + restart: always + net: "host" + privileged: true + env_file: + - openstack.env diff --git a/docker/centos/binary/keepalived/Dockerfile b/docker/centos/binary/keepalived/Dockerfile new file mode 100755 index 000000000..f24954990 --- /dev/null +++ b/docker/centos/binary/keepalived/Dockerfile @@ -0,0 +1,13 @@ +FROM %%KOLLA_NAMESPACE%%/%%KOLLA_PREFIX%%base:%%KOLLA_TAG%% +MAINTAINER Kolla Project (https://launchpad.net/kolla) + +RUN yum -y install \ + hostname \ + keepalived \ + socat \ + && yum clean all + +COPY keepalived.conf /etc/keepalived/ + +COPY start.sh check_alive.sh / +CMD ["/start.sh"] diff --git a/docker/centos/binary/keepalived/build b/docker/centos/binary/keepalived/build new file mode 120000 index 000000000..8d652f7ee --- /dev/null +++ b/docker/centos/binary/keepalived/build @@ -0,0 +1 @@ +../../../../tools/build-docker-image
\ No newline at end of file diff --git a/docker/centos/binary/keepalived/check_alive.sh b/docker/centos/binary/keepalived/check_alive.sh new file mode 100755 index 000000000..ee0c5a85b --- /dev/null +++ b/docker/centos/binary/keepalived/check_alive.sh @@ -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 diff --git a/docker/centos/binary/keepalived/keepalived.conf b/docker/centos/binary/keepalived/keepalived.conf new file mode 100755 index 000000000..2a58fc018 --- /dev/null +++ b/docker/centos/binary/keepalived/keepalived.conf @@ -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 + } +} diff --git a/docker/centos/binary/keepalived/start.sh b/docker/centos/binary/keepalived/start.sh new file mode 100755 index 000000000..7f582b218 --- /dev/null +++ b/docker/centos/binary/keepalived/start.sh @@ -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 diff --git a/docs/integration-guide.md b/docs/integration-guide.md index 106f207e5..e85dd6185 100644..100755 --- a/docs/integration-guide.md +++ b/docs/integration-guide.md @@ -167,6 +167,8 @@ all containers. This allows a simple method of ensuring every type of node CINDER_VOLUME_BACKEND_NAME=<LVM_iSCSI57> - The backend name for a given driver implementation CINDER_VOLUME_DRIVER=<cinder.volume.drivers.lvm.LVMISCSIDriver> - The driver used for volume creation CINDER_ENABLED_BACKEND=<lvm57> - A list of backend names to use + INIT_CINDER_DB=<true|false> - Initialize or update the cinder db + KEEPALIVED_HOST_PRIORITIES=<host1:100,host2:99> - Map of priorities per node. Priorities have to be unique. [Minimum environment variable setup guide.](https://github.com/stackforge/kolla/blob/master/docs/minimal-environment-vars.md) diff --git a/tools/genenv b/tools/genenv index aea05ab39..501527e49 100755 --- a/tools/genenv +++ b/tools/genenv @@ -201,6 +201,10 @@ CINDER_VOLUME_BACKEND_NAME=LVM_iSCSI57 CINDER_VOLUME_DRIVER=cinder.volume.drivers.lvm.LVMISCSIDriver CINDER_ENABLED_BACKEND=lvm57 +# Keepalived +# Here we define pairs hostname:priority. Priorities have to be unique +KEEPALIVED_HOST_PRIORITIES=host1:100,host2:99 + cat > ./openrc <<EOF export OS_AUTH_URL="http://${KEYSTONE_PUBLIC_SERVICE_HOST}:5000/v2.0" export OS_USERNAME=$ADMIN_TENANT_NAME @@ -354,6 +358,8 @@ INIT_GLANCE_DB=$INIT_GLANCE_DB INIT_HEAT_DB=$INIT_HEAT_DB INIT_KEYSTONE_DB=$INIT_KEYSTONE_DB INIT_NOVA_DB=$INIT_NOVA_DB +KEEPALIVED_HOST_PRIORITIES=$KEEPALIVED_HOST_PRIORITIES + EOF echo Please customize your FLAT_INTERFACE to a different network then your echo main network. The FLAT_INTERFACE is used for inter-VM communication. |
