Bug 1013166

Summary: [RFE] Add the ability to adjust when haproxy shutsdown the app cart in the lead gear
Product: OpenShift Online Reporter: Timothy Williams <tiwillia>
Component: ImageAssignee: Ben Parees <bparees>
Status: CLOSED CURRENTRELEASE QA Contact: libra bugs <libra-bugs>
Severity: medium Docs Contact:
Priority: medium    
Version: 1.xCC: bmeng, bparees, dmcphers, xtian, yadu
Target Milestone: ---Keywords: Documentation
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
: 1013167 (view as bug list) Environment:
Last Closed: 2014-04-24 21:34:41 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Bug Depends On:    
Bug Blocks: 1013167    

Description Timothy Williams 2013-09-27 23:41:44 UTC
Description of problem:
Currently, haproxy, when scaled to 3 or more gears, will shutdown the application cartridge (i.e. ruby, python, php, etc) in the gear that also houses haproxy so that haproxy has access to the entire gear's resources. It is requested that the number of gears required to shutdown the application cartridge be adjustable.

The goal of this is to allow the application creator to have one haproxy gear and just one application gear or , if load permits, have 3 total gears and still have the application cartridge running on the haproxy gear.

Additional info:

Current upstream/1.2/2.0 code:

cartridges/openshift-origin-cartridge-haproxy/hooks/set-gear-endpoints

122 # Disable the local endpoint if one of the remote gears is available and it
123 # isn't already disabled
124 if [ $(grep -E "server\s*gear" $HAPROXY_CONFIG | wc -l) -ge 2 ]; then
125     if grep "local-gear" $HAPROXY_CONFIG | grep "weight 0" &>/dev/null; then
126         echo "Local gear already disabled in config. "
127     else
128         echo "Disabling local gear in the config. "
129         nohup $OPENSHIFT_HAPROXY_DIR/usr/bin/fix_local.sh &
130     fi
131 fi

If we change "2" to an adjustable environment variable in line 124, this should achieve the goal. I am unsure if this is the method development would like to take.

Comment 1 Ben Parees 2014-04-09 15:11:50 UTC
Adding a new OPENSHIFT_HAPROXY_GEAR_RATIO env var that can be used to override the default of "3".  This will need to be documented.

Comment 3 Meng Bo 2014-04-11 11:48:45 UTC
Checked on devenv_4547, issue has been fixed.

The new env has been introduced. And works well.

After set the OPENSHIFT_HAPROXY_GEAR_RATIO to 4, the head gear will not DOWN when there are 3 gears. And will DOWN when there are 4 gears.

Move bug to verified.