Bug 1506951
Summary: | Automatically add container provider failed | ||
---|---|---|---|
Product: | OpenShift Container Platform | Reporter: | Gaoyun Pei <gpei> |
Component: | Installer | Assignee: | Tim Bielawa <tbielawa> |
Status: | CLOSED DEFERRED | QA Contact: | Gaoyun Pei <gpei> |
Severity: | medium | Docs Contact: | |
Priority: | medium | ||
Version: | 3.7.0 | CC: | aos-bugs, cbucur, gpei, jokerman, mmccomas |
Target Milestone: | --- | ||
Target Release: | 3.7.z | ||
Hardware: | Unspecified | ||
OS: | Unspecified | ||
Whiteboard: | |||
Fixed In Version: | Doc Type: | Bug Fix | |
Doc Text: |
Cause: While adding providers we were assuming users had defined an optional variable 'openshift_master_cluster_public_hostname'
Consequence: If the variable was not defined by the users then ansible would raise an undefined variable error and crash
Fix: Use 'openshift_master_cluster_public_hostname' if it is defined, otherwise fall-back to using the first master hostname
Result: OCP can be added as a container provider with or without openshift_master_cluster_public_hostname being set
|
Story Points: | --- |
Clone Of: | Environment: | ||
Last Closed: | 2018-11-15 15:00:34 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: |
Description
Gaoyun Pei
2017-10-27 09:18:21 UTC
I see what's happening here. During the failing task I am referencing 'openshift.master.cluster_public_hostname'. I assumed this would get picked up automatically when I called 'openshift_facts' earlier in that task file, but I am seeing now that without 'openshift_master_cluster_public_hostname' set in your inventory, then the value will be empty. I'll make sure I can reproduce this. After a little code peeping, I think it might be safer to reference the 'openshift.master.api_public_hostname' value instead. I'll see if that works as a potential fix. NEEDINFO: - Does your inventory have `openshift_master_cluster_public_hostname` set? ---- Given the steps I took to reproduce the bug, I assume it was not set. Your cluster needs a canonical way to reference it from other clients (MIQ, Web Browsers, CURL, etc). Without `openshift_master_cluster_public_hostname` set, then there is technically no officially designated way to access the frontend of your cluster. While we *could assume* that your first detected master host is your desired API endpoint, that might be foolish and cause more bugs. The other choices I am looking at are adding validation checks into the code to notify users that `openshift_master_cluster_public_hostname` must be set, or else I may just try to parse the closest default fact I can find to make a best-guess at a working API endpoint. Which essentially means using the 'openshift.master.cluster_hostname' fact. In this use-case (adding OCP as a container provider) that will default to using the hostname of the first master in your cluster. I'll try writing up a patch and seeing how it works with `openshift_master_cluster_public_hostname` UNDEFINED in my inventory. Hi Tim, Your assumption is correct, we usually don't set openshift_master_cluster_public_hostname in ansible inventory file unless we were running a native ha-master cluster installation. (In reply to Gaoyun Pei from comment #3) > Hi Tim, > > Your assumption is correct, we usually don't set > openshift_master_cluster_public_hostname in ansible inventory file unless we > were running a native ha-master cluster installation. Thank you for clarifying, Gaoyun, I should have a patch on github today. (In reply to Tim Bielawa from comment #1) > I'll make sure I can reproduce this. After a little code peeping, I think it > might be safer to reference the 'openshift.master.api_public_hostname' value > instead. I'll see if that works as a potential fix. I think this is the path to victory. Pull request submitted with bug fix https://github.com/openshift/openshift-ansible/pull/5989 > The CFME 'automatically add provider' playbook would fail if > openshift_master_cluster_public_hostname was not defined in the > inventory. Now we use that value if it is available, and fallback to > using the masters 'cluster_hostname' otherwise. Hi Tim, met with another error when trying with openshift-ansible-3.7.0-0.196.0.git.0.27cd7ec.el7.noarch [root@gpei-test-ansible ~]# ansible-playbook -i host /usr/share/ansible/openshift-ansible/playbooks/byo/openshift-management/add_container_provider.yml -v ... TASK [openshift_management : Ensure we use openshift_master_cluster_public_hostname if it is available] ********************************************************************* skipping: [openshift-128.lab.sjc.redhat.com] => {"changed": false, "skip_reason": "Conditional result was False", "skipped": true} TASK [openshift_management : Ensure we default to the first master if openshift_master_cluster_public_hostname is unavailable] ********************************************** fatal: [openshift-128.lab.sjc.redhat.com]: FAILED! => {"failed": true, "msg": "The task includes an option with an undefined variable. The error was: 'dict object' has no attribute 'cluster_hostname'\n\nThe error appears to have been in '/usr/share/ansible/openshift-ansible/roles/openshift_management/tasks/add_container_provider.yml': line 19, column 3, but may\nbe elsewhere in the file depending on the exact syntax problem.\n\nThe offending line appears to be:\n\n\n- name: Ensure we default to the first master if openshift_master_cluster_public_hostname is unavailable\n ^ here\n\nexception type: <class 'ansible.errors.AnsibleUndefinedVariable'>\nexception: 'dict object' has no attribute 'cluster_hostname'"} to retry, use: --limit @/usr/share/ansible/openshift-ansible/playbooks/byo/openshift-management/add_container_provider.retry I've moved this to 3.7.z as CFME 4.6 is beta until it's release next year. we'll fix this up post 3.7 GA. There are no active cases related to this bug. As such we're closing this bug in order to focus on bugs that are still tied to active customer cases. Please re-open this bug if this bug becomes relevant to an open customer case. |