Bug 1887791 - Cannot access UI when the UI and the controller pods are deployed in a 3.x cluster
Summary: Cannot access UI when the UI and the controller pods are deployed in a 3.x cl...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Migration Toolkit for Containers
Classification: Red Hat
Component: General
Version: 1.3.z
Hardware: Unspecified
OS: Unspecified
unspecified
medium
Target Milestone: ---
: 1.4.0
Assignee: Erik Nelson
QA Contact: Xin jiang
Avital Pinnick
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2020-10-13 11:10 UTC by Sergio
Modified: 2021-02-11 12:55 UTC (History)
8 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2021-02-11 12:54:46 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2020:5329 0 None None None 2021-02-11 12:55:07 UTC

Description Sergio 2020-10-13 11:10:57 UTC
Description of problem:
When we deploy the controller pod and the UI in the 3.x cluster, the UI does not work.


Version-Release number of selected component (if applicable):
MTC 1.3.1 stage
OCP 3.11 AWS
Browser: Chrome, Firfox

How reproducible:
Always

Steps to Reproduce:
1. Install MTC 1.3.1 from stage repository in a 3.11 OCP cluster 
2. Set up the migration controller like this

    azure_resource_group: ""
    cluster_name: host
    mig_ui_cluster_api_endpoint: https://ec2-XXX-XXX-XX-XX-XX.XXXX.amazonaws.com:8443   <------
    migration_controller: true    <------
    migration_ui: true            <------
    migration_velero: true
    restic_timeout: 1h


3. Configure the cors in the master-config.yml file
4. Try to access the Migration UI

Actual results:
The UI fails and shows the following error in the browser's console

app.bundle.js:106 TypeError: Expected "authorizationUri" to exist

app.bundle.js:16 TypeError: e.toJSON is not a function

app.bundle.js:16 The above error occurred in task u
    created by takeLatest(FETCH_OAUTH_META, u)
    created by anonymous
    created by anonymous
Tasks cancelled due to error:
takeLatest(FETCH_OAUTH_META, u)
takeLatest(LOGOUT_USER_REQUEST, v)
takeLatest(INIT_FROM_STORAGE, h)
takeLatest(FETCH_TOKEN, m)
takeLatest(LOGIN_SUCCESS, y)
takeLatest(FETCH_TENANT_NAMESPACES, g)


Expected results:
The UI should redirect the user to the cluster's login screen, and once authenticated he should be able to access the MTC UI.

Additional info:

Comment 1 Sergio 2020-10-13 14:06:10 UTC
The problem was due to the way used to configure the migrationcontroller resource in order to deploy the UI and the controller.


We executed the following steps:
- Configure the migrationcontroller resource with these values:  
    migration_controller: true
    migration_ui: true
- later on, we added this field to the migrationcontroller resource:
    mig_ui_cluster_api_endpoint: https://XXXXXXX.XXXX-1.XXXXX.com:8443


The second step does not restart the UI pod, so the values available to the UI pod were not the right ones.

After restarting the UI pod manually, it could read the right values and everything worked fine.

In order to configure UI and controller in a 3.x cluster, migrationcontroller's values need to be provided in a single step (migration_ui and mig_ui_cluster_api_endpoint at the same time). Or, if configure mig_ui_cluster_api_endpoint value is configured later on, we need to restart the UI pod manually after the configuration.

Comment 5 Avital Pinnick 2020-12-13 14:05:15 UTC
Ready for QE. I have updated the Kbase article. 

See step 4 of "Installing the MTC on an OpenShift 3.x cluster":

https://access.redhat.com/articles/5064151

Comment 9 Xin jiang 2021-01-11 15:21:32 UTC
verified https://access.redhat.com/articles/5064151.

Comment 10 Avital Pinnick 2021-01-11 15:28:25 UTC
I updated the "Configuring cross-origin resource sharing" section of the Kbase article (https://access.redhat.com/articles/5064151) after QE validation:

>>>
2. Obtain the MTC URL:

$ oc get -n openshift-migration route/migration -o go-template='https://{{ .spec.host }}'

The output resembles the following: https://migration-openshift-migration.apps.cluster.openshift.com.

3. Add the MTC URL to the /etc/origin/master/master-config.yaml file of each master node under corsAllowedOrigins as in the following example:

corsAllowedOrigins:
- (?i}https://migration-openshift-migration\.apps\.cluster\.openshift\.com(:|\z)
>>>

Comment 12 errata-xmlrpc 2021-02-11 12:54:46 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 (Migration Toolkit for Containers (MTC) tool image release advisory 1.4.0), 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-2020:5329


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