osixia / docker-keepalived

Keepalived container image 🐳🌴
MIT License
402 stars 146 forks source link

malformed unicast peer #40

Open sine19 opened 4 years ago

sine19 commented 4 years ago

Im getting this error when starting keepalived docker

(Line 21) Configuration error: VRRP instance[VI_1] malformed unicast peer address[#PYTHON2BASH:['xx.x.xx.x','xx.x.xx.xx']]. Skipping...

Any idea what it is?

I'm using the 2.0.17 version and updated it to the latest stable version 2.0.20. Still the same issue

Soren90 commented 4 years ago

startup.sh seems to never convert the yaml string to bash (line 28):

for peer in $(complex-bash-env iterate KEEPALIVED_UNICAST_PEERS)  
do  
sed -i "s|{{ KEEPALIVED_UNICAST_PEERS }}|${!peer}\n {{ KEEPALIVED_UNICAST_PEERS }}|g"  
 ${CONTAINER_SERVICE_DIR}/keepalived/assets/keepalived.conf  
done  
sed -i "/{{ KEEPALIVED_UNICAST_PEERS }}/d"  
 ${CONTAINER_SERVICE_DIR}/keepalived/assets/keepalived.conf  

I took a closer look into into complex-bash-env and it doesn't seem to interpret "#PYTHON2BASH:" at all

Soren90 commented 4 years ago

We have found the issue. The KEEPALIVED_UNICAST_PEERS variable had quotes in it, which made the PYTHON2BASH not work:

[root@keepalived system]# docker exec -it keepalived bash
bash-5.0# env
KEEPALIVED_UNICAST_PEERS="#PYTHON2BASH:['10.4.52.12','10.4.52.6']"
NoPerfectName commented 4 years ago

We have found the issue. The KEEPALIVED_UNICAST_PEERS variable had quotes in it, which made the PYTHON2BASH not work:

[root@keepalived system]# docker exec -it keepalived bash
bash-5.0# env
KEEPALIVED_UNICAST_PEERS="#PYTHON2BASH:['10.4.52.12','10.4.52.6']"

I have the same problem,Has someone solved it?

sine19 commented 4 years ago

@NoPerfectName Try to use is like this

"KEEPALIVED_UNICAST_PEERS=#PYTHON2BASH:['10.4.52.12','10.4.52.6']"

linkvt commented 4 years ago

@BertrandGouny this ticket can be closed.

BarryLuijten commented 2 years ago

It works when using this format (i.e. using no double quotes at all): KEEPALIVED_UNICAST_PEERS=#PYTHON2BASH:['1.1.1.1', '1.1.1.2', '1.1.1.3'] I'm using an env-file instead of command line variables, so that may be of influence.