Bug 1158704 - Broker fails to create HA DNS entry for application created highly available
Summary: Broker fails to create HA DNS entry for application created highly available
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: OpenShift Container Platform
Classification: Red Hat
Component: Node
Version: 2.2.0
Hardware: Unspecified
OS: Unspecified
high
medium
Target Milestone: ---
: ---
Assignee: chris alfonso
QA Contact: libra bugs
URL:
Whiteboard:
Depends On:
Blocks: 1131518
TreeView+ depends on / blocked
 
Reported: 2014-10-29 22:07 UTC by Miciah Dashiel Butler Masters
Modified: 2016-02-01 02:36 UTC (History)
8 users (show)

Fixed In Version: rubygem-openshift-origin-controller-1.31.5.2-1.el6op
Doc Type: Bug Fix
Doc Text:
Due a bug in the broker's controller library, DNS entries for high-availability applications were not created properly at creation time when using the broker REST API. This was inconsistent with the behavior when creating an application then performing the enable-ha or make-ha action on the existing application. This bug fix updates the controller, as a result the DNS entries are created properly. After applying this update, the openshift-broker service must be restarted.
Clone Of:
Environment:
Last Closed: 2014-12-10 13:24:43 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2014:1979 0 normal SHIPPED_LIVE Red Hat OpenShift Enterprise 2.2.2 bug fix and enhancement update 2014-12-10 18:23:46 UTC

Description Miciah Dashiel Butler Masters 2014-10-29 22:07:27 UTC
Description of problem:

If I use the broker's REST API to create a new application highly available, the broker does not create an HA DNS record for the application.  This is inconsistent with the behaviour when I make a new application and then perform the enable-ha/make-ha action on the existing application.


How reproducible:

Consistently.


Steps to Reproduce:

1. Install OpenShift Enterprise 2.2 PaaS with HA applications enabled and HA enabled for some user.

2. Create a scalable application using `rhc app create testapp8 php-5.4 --no-git -s` using the PaaS and user created in Step 1.

3. Verify that the application created in Step 2 was created successfully and is scalable with 1 gear using `rhc app show testapp8`.

4. Check whether the application created in Step 2 has an HA DNS record using `host ha-testapp8-ose.apps.example.com`.

5. Make the application created in Step 2 HA using `rhc app enable-ha testapp8`.

6. Verify that the application created in Step 2 now has two gears using `rhc app show testapp8`.

7. Verify that the application created in Step 2 now has an HA DNS record using `host ha-testapp8-ose.apps.example.com`.

8. Modify rhc to create new applications HA.

9. Create a new scalable, HA application using `rhc app create testapp9 php-5.4 --no-git -s` on the PaaS created in Step 1.

10. Verify that the application created in Step 9 was created successfully and is scalable with 2 gears (indicating that it is indeed HA) using `rhc app show testapp9`.

11. Check whether the application created in Step 9 has an HA DNS record using `host ha-testapp9-ose.apps.example.com`.



Actual results:

Step 1:

    # grep HA /etc/openshift/broker.conf
    DEFAULT_ALLOW_HA="false"
    ALLOW_HA_APPLICATIONS="true"
    # Should OpenShift handle the registration and deregistration of HA DNS entries pointing to the external router?
    # Set this to "true" if you want OpenShift to create/delete HA DNS entries upon application creation/deletion.
    # When using an external router, if this flag is set to "false", the HA DNS entries will need to be created externally.
    MANAGE_HA_DNS="true"
    # This is the public hostname that the HA DNS entries for an application point to
    # http://${HA_DNS_PREFIX}${APP_NAME}-${DOMAIN_NAME}${HA_DNS_SUFFIX}.${CLOUD_DOMAIN}
    HA_DNS_PREFIX="ha-"
    HA_DNS_SUFFIX=""
    ALLOW_MULTIPLE_HAPROXY_ON_NODE="false"
    # oo-admin-ctl-user -l demo --allowha true
    
    
    User demo already has HA set to true
    
    User demo:
                                plan: 
                    consumed domains: 3
                         max domains: 10
                      consumed gears: 18
                           max gears: 100
        max tracked storage per gear: 0
      max untracked storage per gear: 0
                           max teams: 0
    viewing all global teams allowed: false
                          gear sizes: small
                sub accounts allowed: false
    private SSL certificates allowed: false
                  inherit gear sizes: false
                          HA allowed: true
    
    # 


Step 2:

    # rhc app create testapp8 php-5.4 --no-git -s
    Application Options
    -------------------
    Domain:     ose
    Cartridges: php-5.4
    Gear Size:  default
    Scaling:    yes
    
    Creating application 'testapp8' ... done
    
    
    Waiting for your DNS name to be available ... done
    
    Your application 'testapp8' is now available.
    
      URL:        http://testapp8-ose.apps.example.com/
      SSH to:     54515cb124d7b1e73b000001.example.com
      Git remote: ssh://54515cb124d7b1e73b000001.example.com/~/git/testapp8.git/
    
    Run 'rhc show-app testapp8' for more details about your app.

Step 3:

    # rhc app show testapp8
    testapp8 @ http://testapp8-ose.apps.example.com/
      (uuid: 54515cb124d7b1e73b000001)
    ------------------------------------------------
      Domain:     ose
      Created:    5:31 PM
      Gears:      1 (defaults to small)
      Git URL:    ssh://54515cb124d7b1e73b000001.example.com/~/git/testapp8.git/
      SSH:        54515cb124d7b1e73b000001.example.com
      Deployment: auto (on git push)
    
      haproxy-1.4 (Web Load Balancer)
      -------------------------------
        Gears: Located with php-5.4
    
      php-5.4 (PHP 5.4)
      -----------------
        Scaling: x1 (minimum: 1, maximum: available) on small gears

Step 4:

    # host ha-testapp8-ose.apps.example.com
    Host ha-testapp8-ose.apps.example.com not found: 3(NXDOMAIN)

Step 5:

    # rhc app enable-ha testapp8
    RESULT:
    testapp8 is now highly available

Step 6:

    # rhc app show testapp8
    testapp8 @ http://testapp8-ose.apps.example.com/
      (uuid: 54515cb124d7b1e73b000001)
    ------------------------------------------------
      Domain:     ose
      Created:    5:31 PM
      Gears:      2 (defaults to small)
      Git URL:    ssh://54515cb124d7b1e73b000001.example.com/~/git/testapp8.git/
      SSH:        54515cb124d7b1e73b000001.example.com
      Deployment: auto (on git push)
    
      haproxy-1.4 (Web Load Balancer)
      -------------------------------
        Gears: Located with php-5.4
    
      php-5.4 (PHP 5.4)
      -----------------
        Scaling: x2 (minimum: 2, maximum: available) on small gears

Step 7:

    # host ha-testapp8-ose.apps.example.com
    ha-testapp8-ose.apps.example.com is an alias for www.example.com.
    www.example.com has IPv6 address 2606:2800:220:6d:26bf:1447:1097:aa7

Step 8:
    # vi /usr/lib/ruby/gems/1.8/gems/rhc-1.31.3.1/lib/rhc/commands/app.rb
    # diff -u /usr/lib/ruby/gems/1.8/gems/rhc-1.31.3.1/lib/rhc/commands/app.rb{.old,}
    --- /usr/lib/ruby/gems/1.8/gems/rhc-1.31.3.1/lib/rhc/commands/app.rb.old      2014-10-29 17:34:39.678187439 -0400
    +++ /usr/lib/ruby/gems/1.8/gems/rhc-1.31.3.1/lib/rhc/commands/app.rb    2014-10-29 17:35:08.080182979 -0400
    @@ -600,6 +600,7 @@
             app_options[:deployment_branch] = deployment_branch if deployment_branch
             app_options[:deployment_type] = deployment_type if deployment_type
             app_options[:region] = region if region
    +        app_options[:ha] = true
             debug "Creating application '#{name}' with these options - #{app_options.inspect}"
             rest_domain.add_application(name, app_options)
           rescue RHC::Rest::Exception => e

Step 9:

    # rhc app create testapp9 php-5.4 --no-git -s
    Application Options
    -------------------
    Domain:     ose
    Cartridges: php-5.4
    Gear Size:  default
    Scaling:    yes
    
    Creating application 'testapp9' ... done
    
    
    Waiting for your DNS name to be available ... done
    
    Your application 'testapp9' is now available.
    
      URL:        http://testapp9-ose.apps.example.com/
      SSH to:     54515da124d7b1e73b000035.example.com
      Git remote: ssh://54515da124d7b1e73b000035.example.com/~/git/testapp9.git/
    
    Run 'rhc show-app testapp9' for more details about your app.

Step 10:

    # rhc app show testapp9
    testapp9 @ http://testapp9-ose.apps.example.com/
      (uuid: 54515da124d7b1e73b000035)
    ------------------------------------------------
      Domain:     ose
      Created:    5:35 PM
      Gears:      2 (defaults to small)
      Git URL:    ssh://54515da124d7b1e73b000035.example.com/~/git/testapp9.git/
      SSH:        54515da124d7b1e73b000035.example.com
      Deployment: auto (on git push)
    
      haproxy-1.4 (Web Load Balancer)
      -------------------------------
        Gears: Located with php-5.4
    
      php-5.4 (PHP 5.4)
      -----------------
        Scaling: x2 (minimum: 2, maximum: available) on small gears

Step 11:

    # host ha-testapp9-ose.apps.example.com
    Host ha-testapp9-ose.apps.example.com not found: 3(NXDOMAIN)


Expected results:

At Step 11, we should see that the broker has added a DNS record ha-testapp9-ose.apps.example.com for the new HA application created in Step 9, the same that we see a DNS record ha-testapp8-ose.apps.example.com for the application that was made HA in Step 5.


Additional info:

The REST API that I am using (the "ha" flag when creating an application) is not documented in the REST API guide, and everything works fine if I first create the application and then make it HA, so I would consider this issue low priority.  However, the API does take the ha property that halfway works (as shown above), and we have a testcase for this property:

https://github.com/openshift/origin-server/blob/master/controller/app/controllers/applications_controller.rb#L59
https://github.com/openshift/origin-server/blob/master/broker/test/functional/application_test.rb#L150

The REST API guide only documents the API to make an existing application HA:

https://access.redhat.com/documentation/en-US/OpenShift_Enterprise/2/html-single/REST_API_Guide/index.html#Make_an_Application_Highly_Available_HA

This defect blocks resolution of bug 1131518.

Comment 1 chris alfonso 2014-11-12 20:18:17 UTC
I'm fixing this upstream https://github.com/openshift/origin-server/pull/5956 and will update once the patch is merged, and pulled into enterprise.

Comment 2 chris alfonso 2014-11-18 19:38:09 UTC
This has been built in brew https://brewweb.devel.redhat.com/buildinfo?buildID=398700

Comment 5 Ma xiaoqiang 2014-11-21 06:22:02 UTC
Check on puddle [2.2.z/2014-11-20.1]

1. Allow ha and ha-dns on broker
# grep HA /etc/openshift/broker.conf
    DEFAULT_ALLOW_HA="false"
    ALLOW_HA_APPLICATIONS="true"
    MANAGE_HA_DNS="true"
    HA_DNS_PREFIX="ha-"
#oo-admin-ctl-user -l user --allowha true
2. Create two apps
#rhc app create phpapp1 php-5.4 -s 
#rhc app create phpapp2 php-5.4 -s

3. make ha
#rhc app enable-ha phpapp1
#rhc app enable-ha phpapp2

4. Check the ha-dns
#host ha--phpapp2-xiaom.ose22-auto.com.cn
#host ha--phpapp1-xiaom.ose22-auto.com.cn

The output:
ha-phpapp2-xiaom.ose22-auto.com.cn is an alias for www.example.com.
www.example.com has address 93.184.216.119
www.example.com has IPv6 address 2606:2800:220:6d:26bf:1447:1097:aa7

ha-phpapp2-xiaom.ose22-auto.com.cn is an alias for www.example.com.
www.example.com has address 93.184.216.119
www.example.com has IPv6 address 2606:2800:220:6d:26bf:1447:1097:aa7

Comment 6 Ma xiaoqiang 2014-11-21 06:30:09 UTC
(In reply to Ma xiaoqiang from comment #5)
> Check on puddle [2.2.z/2014-11-20.1]
> 
> 1. Allow ha and ha-dns on broker
> # grep HA /etc/openshift/broker.conf
>     DEFAULT_ALLOW_HA="false"
>     ALLOW_HA_APPLICATIONS="true"
>     MANAGE_HA_DNS="true"
>     HA_DNS_PREFIX="ha-"
> #oo-admin-ctl-user -l user --allowha true
> 2. Create two apps
> #rhc app create phpapp1 php-5.4 -s 
> #rhc app create phpapp2 php-5.4 -s
> 
> 3. make ha
> #rhc app enable-ha phpapp1
> #rhc app enable-ha phpapp2
> 
> 4. Check the ha-dns
> #host ha--phpapp2-xiaom.ose22-auto.com.cn
> #host ha--phpapp1-xiaom.ose22-auto.com.cn
> 
> The output:
> ha-phpapp2-xiaom.ose22-auto.com.cn is an alias for www.example.com.
> www.example.com has address 93.184.216.119
> www.example.com has IPv6 address 2606:2800:220:6d:26bf:1447:1097:aa7
> 
> ha-phpapp2-xiaom.ose22-auto.com.cn is an alias for www.example.com.
> www.example.com has address 93.184.216.119
> www.example.com has IPv6 address 2606:2800:220:6d:26bf:1447:1097:aa7

5. create app with ha option
#vim /usr/lib/ruby/gems/1.8/gems/rhc-1.31.3.1/lib/rhc/commands/app.rb
+ 604         app_options[:ha] = true
# rhc app create phpapp5 php-5.4 -s --no-git

6. # host ha-phpapp5-xiaom.ose22-auto.com.cn
ha-phpapp5-xiaom.ose22-auto.com.cn is an alias for www.example.com.
www.example.com has address 93.184.216.119
www.example.com has IPv6 address 2606:2800:220:6d:26bf:1447:1097:aa7

Comment 8 errata-xmlrpc 2014-12-10 13:24:43 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/RHBA-2014-1979.html


Note You need to log in before you can comment on or make changes to this bug.