Bug 1730905

Summary: API server URL not redirecting to openshift-console
Product: OpenShift Container Platform Reporter: Christoph Blecker <cblecker>
Component: Management ConsoleAssignee: Samuel Padgett <spadgett>
Status: CLOSED NOTABUG QA Contact: Yadan Pei <yapei>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 4.1.zCC: aos-bugs, deads, jokerman, mmccomas, nmukherj, pstrick
Target Milestone: ---   
Target Release: 4.3.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-11-04 18:22:10 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 Christoph Blecker 2019-07-17 20:18:55 UTC
Description of problem:
In 3.x, when you hit the root of the API server (/) in a web browser, it will redirect you to the openshift-console, if installed:
https://github.com/openshift/origin/blob/01dd9628b3bb0d9f310b5faaab63b36797242585/pkg/cmd/openshift-kube-apiserver/openshiftkubeapiserver/webconsole_proxy.go#L43-L80

This functionality seems to be missing from 4.x. This makes it more difficult to access the console if you are logged into the CLI, as you either have to:
- Manually construct the console URL based on defaults, and hope it works
- Have cluster-admin and access the consoles.config.openshift.io/cluster CR, and pull the .status.consoleURL value
- Have access to the openshift-console NS and pull the configuration from the configmap or routes


Version-Release number of selected component (if applicable):
4.x


How reproducible:
Consistently reproducible


Steps to Reproduce:
1. Get API server URL (`oc status`, `oc cluster-info`, `oc config view`)
2. Open the URL in a web browser

Actual results:
Get presented with list of API groups

Expected results:
Get redirected to the openshift-console


Additional info:
Spoke to deads about this one as I was trying to identify the "proper" way for OCP users to get to the console (the other methods I describe may not be available to users who are not cluster-admin). He said that the API server should be doing this redirect, and if it's not, that should be fixed.

Comment 2 Samuel Padgett 2019-07-18 14:09:26 UTC
Hi, we have a new command for getting the console URL.

$ oc whoami --show-console

Any authenticated user can run this command. Is this sufficient?

We had not planned to add the redirect since the console URL is publicly available, although it's something we could add back at this point. I'd argue the console URL is now as easy to get as the API server URL, so the redirect seems less important.

We can also consider printing the URL at other times, maybe after `oc login`.

Comment 3 Christoph Blecker 2019-07-19 22:53:12 UTC
Thanks for passing on the information in the new command. Yes, if I compile oc from HEAD, I see the new flag (it does not appear to be available in the currently released version of oc).

My initial thought is that if it is not difficult to add the redirect back in, then that would be good. Not only does it provide a safe default assumption (where is my oc pointing at, can I point my browser at that), but the API server URL is in a number of places already (oc login, oc status, oc cluster-info, kubeconfig, etc). It would also provide a smooth transition for those coming from 3.x, as that's the default there.

If it is difficult or undesirable to accomplish the redirect in 4.x, then the discoverability of the console URL via the CLI should be increased. The places I've listed above (oc login, oc status, oc cluster-info) should be at least considered to post the console URL or hint at the correct command.

The new command should also probably be documented, as the current docs only tell you to look at the initial installer logs for the console URL: https://docs.openshift.com/container-platform/4.1/web-console/web-console.html

Comment 4 Samuel Padgett 2019-08-22 18:21:22 UTC
I think the best experience is making the console URL easier to discover for CLI users, possibly printing it out on login.

I'm not sure if a redirect is the right thing. It's how things worked for 3.x, but that is more a holdover from when console was part of the API server. Since we don't support in place upgrades from 3.x -> 4.x, we won't be breaking any existing links. If there is a time to change this, it is in 4.x.

Moving out to 4.3 for now since the console URL is discoverable by normal users and this is not a regression from 4.1.

Comment 5 Samuel Padgett 2019-11-04 18:22:10 UTC
This is tracked by RFE https://jira.coreos.com/browse/RFE-58

Since it's possible to discover the URL from the CLI, the installer prints the console URL, and the current behavior works as intended, we'll track this as an enhancement.