Bug 1038730

Summary: Env vars such as OPENSHIFT_KEEP_DEPLOYMENTS are not set/created in new child gears on scale up
Product: OpenShift Online Reporter: Andy Goldstein <agoldste>
Component: PodAssignee: Abhishek Gupta <abhgupta>
Status: CLOSED CURRENTRELEASE QA Contact: libra bugs <libra-bugs>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 2.xCC: jhou
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2014-01-30 00:52:18 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:

Description Andy Goldstein 2013-12-05 16:55:08 UTC
Description of problem: With a scalable app, after configuring e.g. keep-deployments and scaling up, the new child gears are missing e.g. ~/.env/OPENSHIFT_KEEP_DEPLOYMENTS


Version-Release number of selected component (if applicable):


How reproducible: 100%


Steps to Reproduce:
1. Create a scalable app
2. Set keep deployments (rhc app configure -a <app name> --keep-deployments 5)
3. Verify /var/lib/openshift/$gear_for_app/.env/OPENSHIFT_KEEP_DEPLOYMENTS exists
3. Scale up to 2 (rhc cartridge scale -a <app name> -c <cartridge> 2)
4. Verify /var/lib/openshift/$child_gear/.env/OPENSHIFT_KEEP_DEPLOYMENTS exists

Actual results:

In step 4, you get file not found

Expected results:

In step 4, the file exists


Additional info:

[root@ip-10-80-234-239 ~]# rhc app create ps2 php-5.3 -s --no-git
Application Options
-------------------
Domain:     agoldste
Cartridges: php-5.3
Gear Size:  default
Scaling:    yes

Creating application 'ps2' ... done


Waiting for your DNS name to be available ... done

Your application 'ps2' is now available.

  URL:        http://ps2-agoldste.dev.rhcloud.com/
  SSH to:     52a0ad19254d044042000086.rhcloud.com
  Git remote: ssh://52a0ad19254d044042000086.rhcloud.com/~/git/ps2.git/

Run 'rhc show-app ps2' for more details about your app.

[root@ip-10-80-234-239 ~]# rhc app configure -a ps2 --keep-deployments 5
Configuring application 'ps2' ... done

ps2 @ http://ps2-agoldste.dev.rhcloud.com/ (uuid: 52a0ad19254d044042000086)
---------------------------------------------------------------------------
  Deployment:        auto (on git push)
  Keep Deployments:  5
  Deployment Type:   git
  Deployment Branch: master

Your application 'ps2' is now configured as listed above.

Use 'rhc show-app ps2 --configuration' to check your configuration values any time.

[root@ip-10-80-234-239 ~]# cat /var/lib/openshift/ps2-agoldste/.env/OPENSHIFT_KEEP_DEPLOYMENTS
5

[root@ip-10-80-234-239 ~]# rhc cartridge scale -a ps2 php-5.3 2
This operation will run until the application is at the minimum scale and may take several minutes.
Setting scale range for php-5.3 ... done

php-5.3 (PHP 5.3)
-----------------
  Scaling: x2 (minimum: 2, maximum: 2) on small gears

[root@ip-10-80-234-239 ~]# rhc app show ps2 --gears
ID                               State   Cartridges          Size  SSH URL
-------------------------------- ------- ------------------- ----- ------------------------------------------------------------------------------------------
52a0ad19254d044042000086         started php-5.3 haproxy-1.4 small 52a0ad19254d044042000086.rhcloud.com
790c96fc5dcc11e3848812313d1cdd01 started php-5.3 haproxy-1.4 small 790c96fc5dcc11e3848812313d1cdd01.rhcloud.com

[root@ip-10-80-234-239 ~]# cat /var/lib/openshift/ps2-agoldste/.env/OPENSHIFT_KEEP_DEPLOYMENTS
5

[root@ip-10-80-234-239 ~]# cat /var/lib/openshift/790c96fc5dcc11e3848812313d1cdd01/.env/OPENSHIFT_KEEP_DEPLOYMENTS
cat: /var/lib/openshift/790c96fc5dcc11e3848812313d1cdd01/.env/OPENSHIFT_KEEP_DEPLOYMENTS: No such file or directory

Comment 1 Abhishek Gupta 2013-12-05 19:45:17 UTC
Fixed with --> https://github.com/openshift/origin-server/pull/4292

This fix ensures that any new gear that gets created gets the existing application configuration. New gears are created in the following cases:

1. Adding a db gear on a scalable app. 
2. scaling up the cartridge. 
3. adding a new haproxy gear for a multi-ha setup

Comment 3 Jianwei Hou 2013-12-06 02:53:26 UTC
Verified on devenv_4102

Steps:
1. Create a scalable app
2. Set the number of keep deployments
3. Scale up this app
4. ssh into both gears and check the value of env $OPENSHIFT_KEEP_DEPLOYMENTS
5. Add db gear and repeat step 5

Result:
The env $OPENSHIFT_KEEP_DEPLOYMENTS has the correct value in the new gears