Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.

Bug 1100601

Summary: oo-install should add Application Domain suffix to short node name
Product: OpenShift Container Platform Reporter: Anping Li <anli>
Component: InstallerAssignee: Jason DeTiberus <jdetiber>
Status: CLOSED CURRENTRELEASE QA Contact:
Severity: medium Docs Contact:
Priority: medium    
Version: 2.1.0CC: bleanhar, jdetiber, jokerman, libra-bugs, libra-onpremise-devel, lmeyer, mmccomas, yanpzhan
Target Milestone: ---Keywords: Reopened
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2015-03-12 17:18:45 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:
Attachments:
Description Flags
oo-install-cfg.yml none

Description Anping Li 2014-05-23 08:13:47 UTC
Description of problem:

If customer doesn't input full host name (without domain suffix), only input short host name during oo-install. it may cause some problem, for example: Node can't be added to district.

It is better to add Application Domain suffix to short host name. scenarios are as below
1)if customer has specified host name with Domain suffix. oo-install does not need append domain suffix again.
2)if customer has not specified host name with Domain suffix. oo-install should append domain suffix.

Version-Release number of selected component (if applicable):
https://install.openshift.com/ose

How reproducible:
allways

Steps to Reproduce:
1.
2.
3.

Actual results:
Expected results:
Additional info:

Comment 2 Luke Meyer 2014-05-23 13:19:41 UTC
This is in fact how it works, if you respond "y" to the question:

Do you want to register DNS entries for your OpenShift hosts with the
same OpenShift DNS service that will be managing DNS records for the
hosted applications? (y/n/q) n

... in which case you specify the host domain (which is likely different from the app domain), and oo-install appends it if you don't include it in each hostname.

If you don't answer "y" to that question, oo-install has no way to know what domain the hosts should be in. They may be in several domains. "broker" may be a perfectly good FQDN in some setups. It is assumed that you took care of the DNS externally and you know what you're doing.

Please reopen if there are specific steps where oo-install should append the host domain and doesn't.

Comment 3 Jason DeTiberus 2014-05-23 13:26:39 UTC
The user is prompted to enter a FQDN as the hostname with oo-install (and the CONF options in openshift.sh specify they should be FQDNs as well).

Even if the add district command was successful, the installation would still remain broken from outside the host (no apps would be reachable if the node hostname is not a FQDN).

If we tried to do some detection of what the FQDN should be (i.e. if the user set the hosts_domain setting (the What domain do you want to use for the OpenShift hosts? prompt), we don't really enforce that they configure the broker in this domain (we do however enforce the other hosts, which would cause an error to be displayed when adding those hosts to the deployment without the domain name specified for hosts).

It would be possible to enforce this on the broker as well, but then it would break the case of putting the broker behind a load balancer (since the load balancer FQDN would be separate from the host FQDN).

It would also be possible to try to determine if the text they entered is a valid FQDN, but with the recent domain name changes all I believe we'd be able to do without introducing a maintenance nightmare scenario is to determine if they entered in a string that is deliminated by dots.  

tldr; 
I beieve the only way you would hit this bug is if you did a all-in-one deployment using oo-install setting the hostname for the broker as a hostname without domain component, and I'm not sure any of the solutions to resolve the bug are feasible.

Comment 4 Anping Li 2014-06-04 10:14:14 UTC
The bug isn't only exist in all-in-one deployment. 
 
The root cause is that openshift.sh handles hostname in different way. For CONF*_HOSTNAME, openshift.sh appends domain to non-FQDN. For names in CONF_*MAPPINGS|REPLICANTS, it does nothing.

Since non-FQDN is semilegal and openshift.sh will append domain to some non-FQDNs later. To avoid failing district and further more, I think it is better to append app domain suffix to non-FQDN in oo-install-cfg.yml.

Comment 5 Luke Meyer 2014-06-04 20:32:04 UTC
I'll agree it's inconsistent that openshift.sh adds the domain for component hostnames, but doesn't for db or msg replicants (of course, oo-install doesn't handle replicants just yet).

In fact, openshift.sh won't let you use hostnames with no domain - it adds the hosts_domain (which defaults to the apps domain) if there is none. If you actually wanted to use "broker" or "node1" as your FQDN, openshift.sh would refer to it incorrectly everywhere. So I suppose... we could either have openshift.sh not do that (have to consider the use cases carefully) or have oo-install append the apps domain as openshift.sh would when no domain is given.

Comment 6 Jason DeTiberus 2014-09-15 16:29:33 UTC
The refactor for adding ha support will address this.

Comment 8 Anping Li 2014-09-25 06:55:56 UTC
Verified and pass on puddle-2-2-2014-09-23
1. Configure oo-install using hostname without host Domain suffix. and specify the app domain name as ose22-manual-0923.com.cn

cat oo-install-cfg.yml |grep host
    node_hosts: node1,node2
    broker_hostname: 
    ssh_host: 10.xx.xx.xx
    state: host_configured
    host: broker
  - ssh_host: 10.xx.xx.xx
    state: host_configured
    host: node1
  - ssh_host: 10.xx.xx.xx
    state: host_configured
    host: node2

cat oo-install-cfg.yml |grep domain
    app_domain: ose22-manual-0923.com.cn

2. install openshift, after install check the host name. The app domain are added as suffix.
broker.ose22-manual-0923.com.cn
node1.ose22-manual-0923.com.cn
node2.ose22-manual-0923.com.cn

Comment 9 Anping Li 2014-09-25 10:51:07 UTC
Forget  testing about HA,  so drag back On_QA for further more testing.

Comment 10 Anping Li 2014-09-26 08:24:34 UTC
No function in openshift.sh to append  domain suffix for CONF_DISTRICT_MAPPINGS, CONF_DATASTORE_REPLICANTS and CONF_DATASTORE_REPLICANTS.
if oo-install won't append them, I guess the installation may fail. will verify that point once 1146500 is fixed.

Comment 11 Jason DeTiberus 2014-09-26 20:39:54 UTC
Ah, I see the issue now. I was working under the assumption that the non-fqdn hostnames were being passed into the cli interface. 

The installer should have thrown an error in this case, since the hostnames should not have passed validation.

I found an issue with the way that validation was being handled and I am still working out the proper fix (currently users are just told: "Your system deployment configuration is incomplete. The installer will guide you through the necessary configuration steps.") Once I have a fix in place that gives the user a better error message I will push out an updated installer and move the bug back to ON_QA.

Comment 12 Jason DeTiberus 2014-09-29 18:58:04 UTC
Found an issue with the way we were handling errors after the ha refactor, fixed in the latest deployed version at oo-jdetiber1.rhcloud.com.

If you enter just a hostname (without domain) into the cli, then the hosts domain will automatically be appended. 

If you enter a bare hostname into the config and then run the installer using that config, you will get an error and be prompted to update the deployment.

I'm still not totally happy with the prompting for the user to correct the issue, but the bug itself has now been addressed. I have an item on my backlog to further improve the error handling and prompting for the user to correct configuration issues.

Just a reminder, that you must use the installer at / with the -e flag for
testing at this time: sh <(curl -s https://oo-jdetiber1.rhcloud.com/) -e

Comment 13 Anping Li 2014-09-30 06:10:30 UTC
1) For "the hosts domain will automatically be appended1", that works.

-----------Message-------------
Do you want to register DNS entries for your OpenShift hosts with the
same OpenShift DNS service that will be managing DNS records for the
hosted applications? (y/n/q) y

What domain do you want to use for the OpenShift hosts?
|hosts.example.com| 

You have indicated that you want the installer to deploy DNS. Please configure a host to use as the nameserver.

Hostname (the FQDN that other OpenShift hosts will use to connect to
the host that you are describing): broker
Appending component domain 'hosts.example.com' to hostname.

[cn@dhcp-129-213 .openshift]$ cat oo-install-cfg.yml |grep host
  - host: broker.hosts.example.com

2) For "If you enter a bare hostname into the config and then run the installer using that config, you will get an error and be prompted to update the deployment.", I couldn't see any error or warning message, should there be?

Attached oo-oo-install-cfg.yml, I'd like there are warning message about bare hostname to indicate the installation may failed if using bare hostname.

Comment 14 Anping Li 2014-09-30 06:11:44 UTC
Created attachment 942591 [details]
oo-install-cfg.yml

Comment 16 Yanping Zhang 2014-11-06 05:08:51 UTC
Verified on 
sh <(curl -s https://install.openshift.com/ose-2.2).
Steps to verify:
1.Install env with sh <(curl -s https://install.openshift.com/ose-2.2).
2.When input empty hostname, it will prompt info to request for valid hostname until get valid hostname:
<--snip-->
You have indicated that you want the installer to deploy DNS. Please configure a host to use as the nameserver.

Hostname (the FQDN that other OpenShift hosts will use to connect to
the host that you are describing): 
Enter a valid fully-qualified domain name. 'localhost' is not valid
here.
?  
Enter a valid fully-qualified domain name. 'localhost' is not valid
here.
?  broker
Appending component domain 'hosts.example.com' to hostname.
<--snip-->