Bug 1877439

Summary: [ MTC-UI ] Cannot update the remote cluster ssl certificate information when secret is not in openshift-config namespace
Product: Migration Toolkit for Containers Reporter: Sergio <sregidor>
Component: GeneralAssignee: Ian <ibolton>
Status: CLOSED ERRATA QA Contact: Xin jiang <xjiang>
Severity: medium Docs Contact: Avital Pinnick <apinnick>
Priority: unspecified    
Version: 1.3.0CC: chezhang, ernelson, ibolton, mberube, rjohnson, whu, xjiang
Target Milestone: ---   
Target Release: 1.4.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: 2021-02-11 12:54:46 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 Sergio 2020-09-09 16:02:46 UTC
Description of problem:
After adding a remote cluster successfully, if the secret is not located in openshift-config namespace, when we try to update it there is an error in the browser's console and the update cannot be done.

Version-Release number of selected component (if applicable):
CMT 1.3
OCP TARGET: AZURE 4.5
OCP SOURCE: AZURE 4.2
Browser: Chrome

How reproducible:
Always

Steps to Reproduce:
1. Add a remote cluster without ssl certificate. The cluster's secret is in openshift-migration namespace, not in openshift-config namespace. Look at the resource definition in 'Additional info' section.

In order to use a namespace different from openshift-config, we need to create the resource without using the UI.

  serviceAccountSecretRef:
    name: sa-token-source-cluster
    namespace: openshift-migration  <---- this location



2. Once it's connected properly, click "Edit" on the UI
3. Click on "Require SSL Validation"
4. On "CA bundle file", click "Browse" and add a certificate file
5. Click "Update cluster"

Actual results:
The screen does not change, and an error is shown in the browsers console. You can see the error at the end of this summary in the "Additional info" section.


Expected results:
The certificate file should be added and the new connection to the cluster should be done using this certificate.

In previous versions the cluster's secret could be placed in any namespace.


Additional info:


Resource MigCluster
apiVersion: migration.openshift.io/v1alpha1
kind: MigCluster
metadata:
  name: source-cluster
  namespace: openshift-migration
spec:
  insecure: true
  isHostCluster: false
  serviceAccountSecretRef:
    name: sa-token-source-cluster
    namespace: openshift-migration
  storageClasses:
  - accessModes:
    - ReadWriteOnce
    default: true
    name: managed-premium
    provisioner: kubernetes.io/azure-disk
  url: https://api.cam-src-8220.qe.azure.devcluster.openshift.com:6443
status:
  conditions:
  - category: Required
    lastTransitionTime: "2020-09-09T14:28:52Z"
    message: The cluster is ready.
    status: "True"
    type: Ready
  observedDigest: 75c4ac996567aab9bc1967ef083ad1547fc44218768ee9e5d3d0cb1350fe9503




Error shown in console:

app.bundle.js:63 GET https://api.XXXX-az452.qe.azure.devcluster.openshift.com:6443/api/v1/namespaces/openshift-config/secrets/sa-token-source-cluster 404
(anonymous) @ app.bundle.js:63
e.exports @ app.bundle.js:63
e.exports @ app.bundle.js:143
Promise.then (async)
l.request @ app.bundle.js:143
r.forEach.l.<computed> @ app.bundle.js:143
(anonymous) @ app.bundle.js:63
get @ app.bundle.js:143
h @ app.bundle.js:90
m @ app.bundle.js:153
l @ app.bundle.js:153
Promise.then (async)
T @ app.bundle.js:153
(anonymous) @ app.bundle.js:153
h @ app.bundle.js:153
m @ app.bundle.js:153
l @ app.bundle.js:153
k.<computed> @ app.bundle.js:153
(anonymous) @ app.bundle.js:153
h @ app.bundle.js:153
m @ app.bundle.js:153
V @ app.bundle.js:153
(anonymous) @ app.bundle.js:153
m @ app.bundle.js:153
k.<computed> @ app.bundle.js:153
(anonymous) @ app.bundle.js:153
h @ app.bundle.js:153
m @ app.bundle.js:153
l @ app.bundle.js:153
s @ app.bundle.js:153
L.e.put @ app.bundle.js:153
(anonymous) @ app.bundle.js:153
p @ app.bundle.js:153
v @ app.bundle.js:153
u @ app.bundle.js:153
A.e.put @ app.bundle.js:153
(anonymous) @ app.bundle.js:153
(anonymous) @ app.bundle.js:151
updateCluster @ app.bundle.js:63
onAddEditSubmit @ app.bundle.js:63
handleSubmit @ app.bundle.js:138
n.handleSubmit @ app.bundle.js:29
(anonymous) @ app.bundle.js:29
(anonymous) @ app.bundle.js:29
(anonymous) @ app.bundle.js:29
Promise.then (async)
(anonymous) @ app.bundle.js:29
(anonymous) @ app.bundle.js:29
(anonymous) @ app.bundle.js:29
(anonymous) @ app.bundle.js:29
h @ app.bundle.js:106
x @ app.bundle.js:106
(anonymous) @ app.bundle.js:106
O @ app.bundle.js:106
A @ app.bundle.js:106
S @ app.bundle.js:106
T @ app.bundle.js:106
Cn @ app.bundle.js:106
se @ app.bundle.js:106
An @ app.bundle.js:106
kn @ app.bundle.js:106
Tn @ app.bundle.js:106
t.unstable_runWithPriority @ app.bundle.js:114
Yo @ app.bundle.js:106
ce @ app.bundle.js:106
Sn @ app.bundle.js:106
Show 13 more frames
app.bundle.js:16 Error: Request failed with status code 404
    at e.exports (app.bundle.js:63)
    at e.exports (app.bundle.js:143)
    at XMLHttpRequest.u.onreadystatechange (app.bundle.js:63)
b @ app.bundle.js:16
b @ app.bundle.js:153
c @ app.bundle.js:153
t.cont @ app.bundle.js:153
m @ app.bundle.js:153
l @ app.bundle.js:153
n @ app.bundle.js:16
l @ app.bundle.js:153
b @ app.bundle.js:153
c @ app.bundle.js:153
t.cont @ app.bundle.js:153
b @ app.bundle.js:153
c @ app.bundle.js:153
t.cont @ app.bundle.js:153
b @ app.bundle.js:153
c @ app.bundle.js:153
t.cont @ app.bundle.js:153
m @ app.bundle.js:153
l @ app.bundle.js:153
(anonymous) @ app.bundle.js:153
Promise.then (async)
T @ app.bundle.js:153
(anonymous) @ app.bundle.js:153
h @ app.bundle.js:153
m @ app.bundle.js:153
l @ app.bundle.js:153
Promise.then (async)
T @ app.bundle.js:153
(anonymous) @ app.bundle.js:153
h @ app.bundle.js:153
m @ app.bundle.js:153
l @ app.bundle.js:153
k.<computed> @ app.bundle.js:153
(anonymous) @ app.bundle.js:153
h @ app.bundle.js:153
m @ app.bundle.js:153
V @ app.bundle.js:153
(anonymous) @ app.bundle.js:153
m @ app.bundle.js:153
k.<computed> @ app.bundle.js:153
(anonymous) @ app.bundle.js:153
h @ app.bundle.js:153
m @ app.bundle.js:153
l @ app.bundle.js:153
s @ app.bundle.js:153
L.e.put @ app.bundle.js:153
(anonymous) @ app.bundle.js:153
p @ app.bundle.js:153
v @ app.bundle.js:153
u @ app.bundle.js:153
A.e.put @ app.bundle.js:153
(anonymous) @ app.bundle.js:153
(anonymous) @ app.bundle.js:151
updateCluster @ app.bundle.js:63
onAddEditSubmit @ app.bundle.js:63
handleSubmit @ app.bundle.js:138
n.handleSubmit @ app.bundle.js:29
(anonymous) @ app.bundle.js:29
(anonymous) @ app.bundle.js:29
(anonymous) @ app.bundle.js:29
Promise.then (async)
(anonymous) @ app.bundle.js:29
(anonymous) @ app.bundle.js:29
(anonymous) @ app.bundle.js:29
(anonymous) @ app.bundle.js:29
h @ app.bundle.js:106
x @ app.bundle.js:106
(anonymous) @ app.bundle.js:106
O @ app.bundle.js:106
A @ app.bundle.js:106
S @ app.bundle.js:106
T @ app.bundle.js:106
Cn @ app.bundle.js:106
se @ app.bundle.js:106
An @ app.bundle.js:106
kn @ app.bundle.js:106
Tn @ app.bundle.js:106
t.unstable_runWithPriority @ app.bundle.js:114
Yo @ app.bundle.js:106
ce @ app.bundle.js:106
Sn @ app.bundle.js:106
Show 28 more frames
app.bundle.js:16 The above error occurred in task h
    created by takeLatest(UPDATE_CLUSTER_REQUEST, h)
    created by anonymous
    created by anonymous
Tasks cancelled due to error:
takeLatest(UPDATE_CLUSTER_REQUEST, h)

Comment 2 Erik Nelson 2020-09-24 17:14:04 UTC
I'm not able to reproduce this, could you reconfirm?

Comment 3 Xin jiang 2020-09-25 07:30:34 UTC
I confirmed that I can reproduce this.

Comment 6 Ian 2020-12-15 21:24:19 UTC
https://github.com/konveyor/mig-ui/pull/1091 Merged and cherry picked to release-1.4.0

Comment 10 Sergio 2020-12-21 15:02:12 UTC
Verified using MTC 1.4.0

openshift-migration-ui-rhel8@sha256:6aabdf05a9b795cde3a224be3ad917d4246e17db66fba9910080eeb460aed7d8

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