Bug 1732858

Summary: [IPI OSP] platform cloud name is hardcoded to openstack. Installer fails if other name is used
Product: OpenShift Container Platform Reporter: David Sanz <dsanzmor>
Component: InstallerAssignee: Mike Fedosin <mfedosin>
Installer sub component: openshift-installer QA Contact: David Sanz <dsanzmor>
Status: CLOSED ERRATA Docs Contact:
Severity: medium    
Priority: medium CC: eduen, juriarte, mfedosin
Version: 4.2.0   
Target Milestone: ---   
Target Release: 4.2.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2019-10-16 06:31:08 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 David Sanz 2019-07-24 14:25:49 UTC
Description of problem:

According to the docs about clouds.yaml file [1], it can contains different clouds with different names.

When installing OCP4, it only works when cloud name on clouds.yaml file and install-config.yaml is fixed to "openstack"

$ cat clouds.yaml
clouds:
  openstack:
    auth:
[...]

$ cat install-config.yaml
[...]
platform:
  openstack:
    cloud: openstack
[...]

Using another name:
$ cat clouds.yaml
clouds:
  shiftstack:
    auth:
[...]
$ cat clouds.yaml install-config.yaml
[...]
platform:
  openstack:
    cloud: shiftstack
[...]

Result:

$ ./openshift-install create cluster
INFO Consuming "Install Config" from target directory 
INFO Creating infrastructure resources...         
ERROR                                              
ERROR Error: cloud openstack does not exist in clouds.yaml 
ERROR                                              
ERROR   on ../../../../tmp/openshift-install-935212179/main.tf line 1, in provider "openstack": 
ERROR    1: provider "openstack" {                 
ERROR                                              
ERROR                                              
ERROR Failed to read tfstate: open /tmp/openshift-install-935212179/terraform.tfstate: no such file or directory 
FATAL failed to fetch Cluster: failed to generate asset "Cluster": failed to create cluster: failed to apply using Terraform 


Version-Release number of the following components:
$ ./openshift-install version
./openshift-install v4.2.0-201907240619-dirty
built from commit 1ef9ea7c01838360c09e5daf429ccde718f310cb
release image registry.svc.ci.openshift.org/ocp/release@sha256:6081c39905b0e1395519d21a9ad33d8f6776acaee89613accb76914ade2dfebd

How reproducible:

Steps to Reproduce:
1.Extract installer
2.Create cloud.yaml and install-config.yaml files
3.Execute openshift-install create cluster

Actual results:
$ ./openshift-install create cluster
INFO Consuming "Install Config" from target directory 
INFO Creating infrastructure resources...         
ERROR                                              
ERROR Error: cloud openstack does not exist in clouds.yaml 
ERROR                                              
ERROR   on ../../../../tmp/openshift-install-935212179/main.tf line 1, in provider "openstack": 
ERROR    1: provider "openstack" {                 
ERROR                                              
ERROR                                              
ERROR Failed to read tfstate: open /tmp/openshift-install-935212179/terraform.tfstate: no such file or directory 
FATAL failed to fetch Cluster: failed to generate asset "Cluster": failed to create cluster: failed to apply using Terraform 


Expected results:
Installer looks at the cloud.yaml finding the correct cloud name

Additional info:
Please attach logs from ansible-playbook with the -vvv flag

[1] https://docs.openstack.org/python-openstackclient/queens/configuration/index.html#clouds-yaml

Comment 1 Mike Fedosin 2019-07-30 16:52:40 UTC
Fix is on review: https://github.com/openshift/installer/pull/2122

Comment 2 Jon Uriarte 2019-08-01 14:23:54 UTC
Some input from the OCP hackfest:

Same error when using the wizard, so no install-config.yaml is manually provided
(needed to apply https://github.com/openshift/installer/pull/2036).


$ $GOPATH/src/github.com/openshift/installer/bin/openshift-install --log-level=debug create cluster --dir ${HOME}/ostest

DEBUG       Generating "SSH Key"...                
? SSH Public Key /home/stack/.ssh/id_rsa.pub
DEBUG       Fetching "Base Domain"...              
DEBUG         Fetching "Platform"...               
DEBUG         Generating "Platform"...             
? Platform openstack
? Cloud shiftstack
? Region regionOne
? ExternalNetwork nova
? FlavorName m1.large
DEBUG       Generating "Base Domain"...            
? Base Domain shiftstack.com
DEBUG       Fetching "Cluster Name"...             
DEBUG         Fetching "Base Domain"...            
DEBUG         Reusing previously-fetched "Base Domain" 
DEBUG       Generating "Cluster Name"...           
? Cluster Name ostest
DEBUG       Fetching "Pull Secret"...              
DEBUG       Generating "Pull Secret"...            
? Pull Secret [? for help] 
***************************************************
DEBUG       Fetching "Platform"...                 
DEBUG       Reusing previously-fetched "Platform"  
DEBUG     Generating "Install Config"...           
DEBUG   Generating "Cluster ID"...                 
DEBUG   Fetching "Install Config"...               

...

ERROR                                              
ERROR Error: cloud openstack does not exist in clouds.yaml 
ERROR                                              
ERROR   on ../../tmp/openshift-install-417308150/main.tf line 1, in provider "openstack": 
ERROR    1: provider "openstack" {                 
ERROR                                              
ERROR                                              
ERROR Failed to read tfstate: open /tmp/openshift-install-417308150/terraform.tfstate: no such file or directory 
FATAL failed to fetch Cluster: failed to generate asset "Cluster": failed to create cluster: failed to apply using Terraform 


$ cat clouds.yaml 
#BEGIN HEADER
clouds:
#END HEADER
#BEGIN undercloud PARAMETERS
 undercloud:
    auth:
        auth_url: https://192.168.24.2:13000/
        password: 63iMZVPLqemnETKama4iP4jLW
        project_domain_name: Default
        project_name: admin
        user_domain_name: Default
        username: admin
    identity_api_version: '3'
#END undercloud PARAMETERS
#BEGIN overcloud PARAMETERS
 overcloud:
    auth:
        auth_url: http://10.46.22.145:5000/v3
        password: 8FpckcPqyujwNFuoqJJloSR7t
        project_domain_name: Default
        project_name: admin
        user_domain_name: Default
        username: admin
    identity_api_version: '3'
#END overcloud PARAMETERS
#BEGIN openstack PARAMETERS
 shiftstack:
    auth:
        auth_url: http://10.46.22.145:5000/v3
        password: redhat
        project_domain_name: Default
        project_name: shiftstack
        project_id: 84fa620aa3c94f9085f37ab6120f6a6d
        user_domain_name: Default
        username: shiftstack_user
    identity_api_version: '3'
#END openstack PARAMETERS

Comment 5 David Sanz 2019-08-19 09:23:06 UTC
Verified on:

$ ./openshift-install version
./openshift-install v4.2.0-201908181300-dirty
built from commit 4e204c5e509de1bd31113b0c0e73af1a35e52c0a
release image registry.svc.ci.openshift.org/ocp/release@sha256:d199bece55512628560129183830be1db55d388c3caefe684b4a37033ea779c2

Comment 6 errata-xmlrpc 2019-10-16 06:31:08 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://access.redhat.com/errata/RHBA-2019:2922