From af2225104f70cfd1d341dbf08e03023c88209ccb Mon Sep 17 00:00:00 2001 From: Emilien Macchi Date: Tue, 29 Apr 2014 15:55:02 +0200 Subject: [PATCH] loadbalancer: do not manage HAproxy service on BACKUP nodes When a loadbalancer is in BACKUP mode, HAproxy can't bind the pools to the VIP, since the VIP is not hosted. Puppet warns it when compiling in the catalogue. This patch ensure HAproxy is run where we Keepalived is in MASTER mode. If a failover occurs and MASTER has changed, Keepalived & HAproxy are auto-migrated thanks to VRRP to another node. The worth case will only show warnings in Puppet catalog but HAproxy won't start anyway on the node. Bug #237 --- spec/classes/cloud_loadbalancer_spec.rb | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/spec/classes/cloud_loadbalancer_spec.rb b/spec/classes/cloud_loadbalancer_spec.rb index 741253a4..65bed2f3 100644 --- a/spec/classes/cloud_loadbalancer_spec.rb +++ b/spec/classes/cloud_loadbalancer_spec.rb @@ -111,7 +111,7 @@ describe 'cloud::loadbalancer' do end end - context 'configure keepalived in backup' do + context 'when keepalived and HAproxy are in backup' do it 'configure vrrp_instance with BACKUP state' do should contain_keepalived__instance('1').with({ 'interface' => params[:keepalived_public_interface], @@ -123,6 +123,9 @@ describe 'cloud::loadbalancer' do 'notify_backup' => '"/etc/init.d/haproxy stop"', }) end # configure vrrp_instance with BACKUP state + it 'configure haproxy server without service managed' do + should contain_class('haproxy').with(:service_manage => false) + end # configure haproxy server end # configure keepalived in backup context 'configure keepalived in master' do @@ -139,6 +142,9 @@ describe 'cloud::loadbalancer' do 'notify_backup' => '"/etc/init.d/haproxy stop"', }) end + it 'configure haproxy server with service managed' do + should contain_class('haproxy').with(:service_manage => true) + end # configure haproxy server end # configure keepalived in master context 'configure logrotate file' do