Loadbalancer: Use balance => source for connection that have session.
In order to avoid the Connection Reset By Peer error, (ie. #561), we use balancer => source for every connection that involves session. Currently, spice_cluster and glance_api_cluster.
This commit is contained in:
		@@ -372,12 +372,13 @@ class cloud::loadbalancer(
 | 
			
		||||
    ip                 => $spice,
 | 
			
		||||
    port               => $spice_port,
 | 
			
		||||
    options            => {
 | 
			
		||||
      'balance'        => 'leastconn',
 | 
			
		||||
      'mode'           => 'tcp',
 | 
			
		||||
      'option'         => ['tcpka', 'tcplog', 'forwardfor'],
 | 
			
		||||
      'balance'        => 'source',
 | 
			
		||||
      'timeout server' => '120m',
 | 
			
		||||
      'timeout client' => '120m',
 | 
			
		||||
    },
 | 
			
		||||
    bind_options       => $spice_bind_options,
 | 
			
		||||
    httpchk            => 'httpchk GET /';
 | 
			
		||||
  }
 | 
			
		||||
  cloud::loadbalancer::binding { 'trove_api_cluster':
 | 
			
		||||
    ip           => $trove_api,
 | 
			
		||||
@@ -387,7 +388,9 @@ class cloud::loadbalancer(
 | 
			
		||||
  cloud::loadbalancer::binding { 'glance_api_cluster':
 | 
			
		||||
    ip                 => $glance_api,
 | 
			
		||||
    options            => {
 | 
			
		||||
      'balance'        => 'leastconn',
 | 
			
		||||
      'mode'           => 'tcp',
 | 
			
		||||
      'balance'        => 'source',
 | 
			
		||||
      'option'         => ['tcpka', 'tcplog', 'forwardfor'],
 | 
			
		||||
      'timeout server' => '120m',
 | 
			
		||||
      'timeout client' => '120m',
 | 
			
		||||
    },
 | 
			
		||||
 
 | 
			
		||||
@@ -26,15 +26,20 @@ define cloud::loadbalancer::listen_http(
 | 
			
		||||
 | 
			
		||||
  $options_basic = {'mode'       => 'http',
 | 
			
		||||
                    'balance'    => 'roundrobin',
 | 
			
		||||
                    'http-check' => 'expect ! rstatus ^5',
 | 
			
		||||
                    'option'     => ['tcpka', 'forwardfor', 'tcplog', $httpchk] }
 | 
			
		||||
 | 
			
		||||
  $options_custom = merge($options_basic, $options)
 | 
			
		||||
 | 
			
		||||
  if $options_custom['mode'] == 'http' {
 | 
			
		||||
    $final_options = merge($options_custom, { 'http-check' => 'expect ! rstatus ^5' })
 | 
			
		||||
  } else {
 | 
			
		||||
    $final_options = $options_custom
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  haproxy::listen { $name:
 | 
			
		||||
    ipaddress    => $listen_ip,
 | 
			
		||||
    ports        => $ports,
 | 
			
		||||
    options      => $options_custom,
 | 
			
		||||
    options      => $final_options,
 | 
			
		||||
    bind_options => $bind_options,
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -209,10 +209,9 @@ describe 'cloud::loadbalancer' do
 | 
			
		||||
        :ipaddress => [params[:vip_public_ip]],
 | 
			
		||||
        :ports     => '6082',
 | 
			
		||||
        :options   => {
 | 
			
		||||
          'mode'           => 'http',
 | 
			
		||||
          'option'         => ['tcpka', 'forwardfor', 'tcplog','httpchk GET /'],
 | 
			
		||||
          'http-check'     => 'expect ! rstatus ^5',
 | 
			
		||||
          'balance'        => 'leastconn',
 | 
			
		||||
          'mode'           => 'tcp',
 | 
			
		||||
          'balance'        => 'source',
 | 
			
		||||
          'option'         => ['tcpka', 'tcplog', 'forwardfor'],
 | 
			
		||||
          'timeout server' => '120m',
 | 
			
		||||
          'timeout client' => '120m'
 | 
			
		||||
        }
 | 
			
		||||
@@ -370,7 +369,6 @@ describe 'cloud::loadbalancer' do
 | 
			
		||||
        :ports     => '443',
 | 
			
		||||
        :options   => {
 | 
			
		||||
          'mode'           => 'tcp',
 | 
			
		||||
          'http-check'     => 'expect ! rstatus ^5',
 | 
			
		||||
          'option'         => ['tcpka','forwardfor','tcplog',  'ssl-hello-chk'],
 | 
			
		||||
          'cookie'         => 'sessionid prefix',
 | 
			
		||||
          'balance'        => 'leastconn',
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user