Bug 1255426

Summary: API Call to disable HA does not remove 2nd haproxy head gear
Product: OpenShift Container Platform Reporter: Ryan Howe <rhowe>
Component: MasterAssignee: Timothy Williams <tiwillia>
Status: CLOSED ERRATA QA Contact: Gaoyun Pei <gpei>
Severity: urgent Docs Contact:
Priority: unspecified    
Version: 2.2.0CC: adellape, bperkins, jokerman, libra-bugs, mmccomas, nicholas_schuetz, pep, philfest, tiwillia
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: rubygem-openshift-origin-controller-1.38.4.1-1.el6op Doc Type: Bug Fix
Doc Text:
Previously, setting a minimum scale of at least 2 on an application and then making the application highly-available (HA) caused configuration issues for the application. This caused the application to be unable to unset HA and set the minimum scale back down to 1. With this bug fix, when an application has HA disabled, the configuration now allows the application to be scaled back down to a single gear.
Story Points: ---
Clone Of: Environment:
Last Closed: 2015-12-17 17:10:37 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:    
Bug Blocks: 1273542    

Comment 2 Ryan Howe 2015-10-07 14:52:30 UTC
Do we have a workaround to manually disable HA so that the 2nd haproxy cartridge gets removed?

Comment 4 Ryan Howe 2015-10-15 20:35:24 UTC
Scaling application down does not work as it will scale down but when scaled back up again the HAPROXY cart is seen on the 2nd gear even with HA DISABLED. 


[root@broker ~]# rhc app enable-ha test
RESULT:
test is now highly available


[root@broker ~]# curl -kX POST https://broker.example.com/broker/rest/application/562002e36892df8a59000007/events --user ryan:ryan --data-urlencode event=disable-ha


[root@broker ~]# rhc app show -a test -g
ID                       State   Cartridges          Size  SSH URL
------------------------ ------- ------------------- ----- ----------------------------------------------
562002e36892df8a59000007 started haproxy-1.4 php-5.4 small 562002e36892df8a59000007.com



[root@broker ~]# rhc cartridge scale php-5.4 -a test --min 2
This operation will run until the application is at the minimum scale and may take several minutes.
Setting scale range for php-5.4 ... done

php-5.4 (PHP 5.4)
-----------------
  Scaling: x2 (minimum: 2, maximum: available) on small gears
[root@broker ~]# rhc app show -a test -g
ID                       State   Cartridges          Size  SSH URL
------------------------ ------- ------------------- ----- ------------------------------------------------------------------
562002e36892df8a59000007 started haproxy-1.4 php-5.4 small 562002e36892df8a59000007.com
56200b5d6892df8a59000094 started haproxy-1.4 php-5.4 small 56200b5d6892df8a59000094.com

Comment 5 Ryan Howe 2015-10-22 17:56:22 UTC
#####UPDATE###### 

Disabling HA with API call works as long as a min is not set while the application has HA enabled. 

When HA is enabled and the application gets a MIN set that is set at 3 or more, the application is unable scale back down to 1 gear when HA is disabled.  


# rhc app create -a foo jbosseap-6 -s
# rhc app enable-ha -a foo
# rhc cartridge scale jboss  -a foo --min 3
# oo-app-info -a open --raw

- haproxy cart can be seen as added to the group components

#   curl -kX POST https://broker.example.com/broker/rest/application/562906f96892df6a5b000179/events --user ryan:ryan --data-urlencode event=disable-ha

# rhc cartridge scale jboss  -a open --min 1
# rhc cartridge scale jboss  -a open --max 1
Cannot scale down by 1 as it violates the minimum gear restrictions for sparse cartridges.

Comment 8 openshift-github-bot 2015-10-30 17:33:19 UTC
Commit pushed to master at https://github.com/openshift/origin-server

https://github.com/openshift/origin-server/commit/006ac9886ec85dab6639d0668da9e978a5d1bece
Delete explicit haproxy component overrides when disabling ha

Bug 1255426
https://bugzilla.redhat.com/show_bug.cgi?id=1255426

When an application has a minimum and/or maximum scaling limit set, it is possible that implicit overrides for HA applications will be set as explicit overrides in the database. This previously caused applications that were made ha, then had a scaling limit set, then had ha disabled to be unable to scale back down to a single haproxy cartridge.

With this change, the explicit overrides will be removed if they exist when an HA application has HA disabled.

Comment 13 Gaoyun Pei 2015-11-19 07:33:23 UTC
Verify this bug with rubygem-openshift-origin-controller-1.38.4.1-1.el6op.noarch

Steps:
1. Create a scaling perl app
   #rhc app create app1 perl -s

2. Set min 2 gears of the perl cartridge of app1
   #rhc cartridge-scale perl -a app1 --min 2

3. Enable this app as HA
   #rhc app-enable-ha app1

4. Disable HA for this app
   #curl -k -X POST https://${hostname}/broker/rest/application/564d77cb82611da0cf000009/events -u xxx:xxx -d event=disable-ha

5. Scale down the app to 1 gear
   #rhc cartridge-scale perl -a app1 --max 1

6. Check this app
[root@broker ~]# rhc app show app1 --gears
ID         State   Cartridges            Size  SSH URL
---------- ------- --------------------- ----- -------------------------------------
yes-app1-1 started haproxy-1.4 perl-5.10 small yes-app1-1.com.cn

Comment 17 errata-xmlrpc 2015-12-17 17:10:37 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.

https://rhn.redhat.com/errata/RHSA-2015-2666.html