Bug 1051190

Summary: Provide ability to customize haproxy auto scaling algorithm
Product: OpenShift Container Platform Reporter: John Keck <jkeck>
Component: RFEAssignee: Brenton Leanhardt <bleanhar>
Status: CLOSED ERRATA QA Contact:
Severity: medium Docs Contact:
Priority: medium    
Version: 2.0.0CC: adellape, gpei, jialiu, jolamb, mbarrett, nwei, pruan
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: openshift-origin-cartridge-haproxy-1.17.3.5-1.el6op Doc Type: Enhancement
Doc Text:
Users can now create a new action hook that makes automatic scaling decisions for a specific application using a customized haproxy_ctld.rb script. See the OpenShift Enterprise User Guide for more information.
Story Points: ---
Clone Of: Environment:
Last Closed: 2014-02-25 15:42:55 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:
Embargoed:
Bug Depends On: 1057558    
Bug Blocks:    

Description John Keck 2014-01-09 20:10:16 UTC
Description of problem:

Provide support for customizing the haproxy auto scaling algorithm.  The following pull request needs to be merged into Enterprise 2.

https://github.com/openshift/origin-server/pull/4323

Comment 2 Brenton Leanhardt 2014-01-24 18:28:24 UTC
Upstream commits:

commit 73b90a9488dac9c82e9ae8d4132e5d94d59a69c9
Author: Mike McGrath <mmcgrath>
Date:   Wed Dec 11 17:00:41 2013 -0600

    checking for executible bits prior to execution

commit 1e78a3bf067dc81e993639ea47a46887136eeb37
Author: Mike McGrath <mmcgrath>
Date:   Wed Dec 11 16:52:24 2013 -0600

    updated typos as per pull request

commit 1d5bbced6cd14a279b4e6b19921e416d4b29e142
Author: Mike McGrath <mmcgrath>
Date:   Wed Dec 11 14:59:51 2013 -0600

    allow for customized haproxy_ctld.rb file to exist

commit e5fb1073aa8425a6a213afd941d3fd08605f4672
Author: Mike McGrath <mmcgrath>
Date:   Wed Dec 11 14:24:48 2013 -0600

    added haproxy_ctld comments and ability to run custom haproxy_ctld

Comment 4 Brenton Leanhardt 2014-01-24 19:17:59 UTC
I'm CC'ing Alex so docs can think about what they would like to do for this new feature.  It's pretty simple to use.  Check in your own implementation to /.openshift/action_hooks/haproxy_ctld.rb and make sure it's executable.

Comment 8 Gaoyun Pei 2014-01-28 07:53:26 UTC
Test this feature with openshift-origin-cartridge-haproxy-1.17.3.4-1.el6op.

Found the customized haproxy_ctld.rb action-hook will not take effect till the haproxy cartridge get restart. BZ#1057558 told more detail about this.

Comment 11 Nan Wei 2014-02-11 07:10:11 UTC
openshift enterprise: 2014-02-10.2

1. Create scalable app
2. Add haproxy_ctld.rb to .openshift/action_hooks/ with x permission
3. Git push the change
remote: Deployment id is cb47259f
remote: Activating deployment
remote: HAProxy already running
remote: Action hook haproxy_ctld.rb detected
remote: Action hook haproxy_ctld.rb restarted
remote: HAProxy instance is started

Comment 12 Nan Wei 2014-02-11 07:38:39 UTC
openshift enterprise: 2014-02-10.2

1. Create scalable app
2. Add customize haproxy_ctld.rb to .openshift/action_hooks/ with x permission
FLAP_PROTECTION_TIME_SECONDS = 200
gear_up_pct = 30.0
3. Git push the change
remote: Deployment id is cb47259f
remote: Activating deployment
remote: HAProxy already running
remote: Action hook haproxy_ctld.rb detected
remote: Action hook haproxy_ctld.rb restarted
remote: HAProxy instance is started
4. check scale_events.log
tailf /var/lib/openshift/$uuid/haproxy/logs/scale_events.log
D, [2014-02-11T02:22:32.084319 #8945] DEBUG -- : GEAR_INFO - capacity: 6.25% gear_count: 1 sessions: 1 up/remove_thresh: 30.0%/1.0% sec_left_til_remove: 140 gear_remove_thresh: 0/20
D, [2014-02-11T02:22:37.690486 #8945] DEBUG -- : Local sessions 7
D, [2014-02-11T02:22:37.734693 #8945] DEBUG -- : Got stats from 0 remote proxies.
I, [2014-02-11T02:22:37.785819 #8945]  INFO -- : add-gear - capacity: 43.75% gear_count: 1 sessions: 7 up_thresh: 30.0%

After 200 seconds: 
D, [2014-02-11T02:27:46.808533 #8945] DEBUG -- : Got stats from 0 remote proxies.
D, [2014-02-11T02:27:46.808642 #8945] DEBUG -- : GEAR_INFO - capacity: 0.0% gear_count: 1 sessions: 0 up/remove_thresh: 30.0%/1.0% sec_left_til_remove: 0 gear_remove_thresh: 0/20
D, [2014-02-11T02:27:51.809914 #8945] DEBUG -- : Local sessions 0
D, [2014-02-11T02:27:51.812755 #8945] DEBUG -- : Got stats from 0 remote proxies.

Comment 14 errata-xmlrpc 2014-02-25 15:42:55 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

http://rhn.redhat.com/errata/RHBA-2014-0209.html