diff --git a/Makefile b/Makefile index 2c61437..42f71d6 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,5 @@ NAME = osixia/keepalived -VERSION = 1.4.2 +VERSION = 1.4.3 .PHONY: build build-nocache test tag-latest push push-latest release git-tag-version diff --git a/image/environment/default.yaml b/image/environment/default.yaml index 9b1df52..8d7f815 100644 --- a/image/environment/default.yaml +++ b/image/environment/default.yaml @@ -16,3 +16,5 @@ KEEPALIVED_VIRTUAL_IPS: - 192.168.1.232 KEEPALIVED_NOTIFY: /container/service/keepalived/assets/notify.sh + +KEEPALIVED_ROUTER_ID: 51 diff --git a/image/service/keepalived/assets/keepalived.conf b/image/service/keepalived/assets/keepalived.conf index 2b7142a..c847b60 100644 --- a/image/service/keepalived/assets/keepalived.conf +++ b/image/service/keepalived/assets/keepalived.conf @@ -10,7 +10,7 @@ vrrp_instance VI_1 { } state BACKUP - virtual_router_id 51 + virtual_router_id {{ KEEPALIVED_ROUTER_ID }} priority {{ KEEPALIVED_PRIORITY }} nopreempt diff --git a/image/service/keepalived/startup.sh b/image/service/keepalived/startup.sh index 5845974..cf2b08a 100755 --- a/image/service/keepalived/startup.sh +++ b/image/service/keepalived/startup.sh @@ -11,6 +11,7 @@ if [ ! -e "$FIRST_START_DONE" ]; then # # bootstrap config # + sed -i "s|{{ KEEPALIVED_ROUTER_ID }}|$KEEPALIVED_ROUTER_ID|g" ${CONTAINER_SERVICE_DIR}/keepalived/assets/keepalived.conf sed -i "s|{{ KEEPALIVED_INTERFACE }}|$KEEPALIVED_INTERFACE|g" ${CONTAINER_SERVICE_DIR}/keepalived/assets/keepalived.conf sed -i "s|{{ KEEPALIVED_PRIORITY }}|$KEEPALIVED_PRIORITY|g" ${CONTAINER_SERVICE_DIR}/keepalived/assets/keepalived.conf sed -i "s|{{ KEEPALIVED_PASSWORD }}|$KEEPALIVED_PASSWORD|g" ${CONTAINER_SERVICE_DIR}/keepalived/assets/keepalived.conf