Skip to content

Commit 142e63f

Browse files
authored
Create consoleLinkDomain ENV Var (opendatahub-io#3456)
1 parent 24024ae commit 142e63f

File tree

4 files changed

+30
-14
lines changed

4 files changed

+30
-14
lines changed

Diff for: backend/src/utils/prometheusUtils.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,8 @@ const generatePrometheusHostURL = (
7777
): string => {
7878
if (DEV_MODE) {
7979
const apiPath = fastify.kube.config.getCurrentCluster().server;
80-
const namedHost = apiPath.slice('https://api.'.length).split(':')[0];
80+
const namedHost =
81+
process.env.CONSOLE_LINK_DOMAIN || apiPath.slice('https://api.'.length).split(':')[0];
8182
return `https://${instanceName}-${namespace}.apps.${namedHost}`;
8283
}
8384
return `https://${instanceName}.${namespace}.svc.cluster.local:${port}`;

Diff for: docs/dev-setup.md

+24-11
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,13 @@ ODH requires the following to run:
1818
## Development
1919

2020
1. Clone the repository
21-
``` bash
22-
git clone https://github.com/opendatahub-io/odh-dashboard
23-
```
21+
```bash
22+
git clone https://github.com/opendatahub-io/odh-dashboard
23+
```
2424
2. Within the repo context, install project dependencies
25-
```bash
26-
cd odh-dashboard && npm install
27-
```
25+
```bash
26+
cd odh-dashboard && npm install
27+
```
2828

2929
### Build project
3030

@@ -34,7 +34,7 @@ npm run build
3434

3535
### Serve development content
3636

37-
This is the default context for running a local UI. Make sure you build the project using the instructions above prior to running the command below.
37+
This is the default context for running a local UI. Make sure you build the project using the instructions above prior to running the command below.
3838

3939
> Note: You must be logged-in with `oc` before you can start the backend. Details for that are in the the [contribution guidelines](../CONTRIBUTING.md#give-your-dev-env-access).
4040
@@ -52,9 +52,9 @@ For in-depth local run guidance review the [contribution guidelines](../CONTRIBU
5252

5353
Run the tests.
5454

55-
```bash
56-
npm run test
57-
```
55+
```bash
56+
npm run test
57+
```
5858

5959
For in-depth testing guidance review the [testing guidelines](./testing.md)
6060

@@ -64,13 +64,26 @@ Feature flags are defined in the [dashboard config](./dashboard-config.md#featur
6464

6565
With the dev feature flags modal opened, the browser URL will update to include the current feature flag enablement settings. The URL can then be bookmarked or shared.
6666

67+
### Configuring Custom Console Link Domain (CONSOLE_LINK_DOMAIN)
68+
69+
Certain environments require custom access configurations for the OpenShift console and Prometheus endpoints because they may not have access to internal services. To support these configurations, the CONSOLE_LINK_DOMAIN environment variable allows developers to specify a custom domain to override default calculations.
70+
71+
Steps to Configure:
72+
73+
1. Open the root `.env.local` file (or create it if it doesn't exist).
74+
2. Add the following line to define the custom console domain:
75+
76+
<code>CONSOLE_LINK_DOMAIN=your-custom-domain.com</code>
77+
78+
Replace your-custom-domain.com with the specific domain for your OpenShift console
79+
6780
## Deploying the ODH Dashbard
6881

6982
### Official Image Builds
7083

7184
odh-dashboard images are automatically built and pushed to [quay.io](https://quay.io/repository/opendatahub/odh-dashboard) after every commit to the `main` branch. The image tag name format for each image is `main-<COMMIT SHORT HASH>`.
7285

73-
Example: The `main` branch is updated with commit `f76e3952834f453b1d085e8627f9c17297c2f64c`. The CI system will automatically build an odh-dashboard image based on that code and push the new image to `odh-dashboard:main-f76e395` and updated `odh-dashboard:main` to point to the same image hash.
86+
Example: The `main` branch is updated with commit `f76e3952834f453b1d085e8627f9c17297c2f64c`. The CI system will automatically build an odh-dashboard image based on that code and push the new image to `odh-dashboard:main-f76e395` and updated `odh-dashboard:main` to point to the same image hash.
7487

7588
The [nightly](https://quay.io/opendatahub/odh-dashboard:nightly) tag is a floating tag that is updated nightly and points to the most recent `main-<HASH>` commit from the previous day.
7689

Diff for: frontend/src/utilities/clusterUtils.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
import { useClusterInfo } from '~/redux/selectors/clusterInfo';
2-
import { DEV_MODE } from '~/utilities/const';
2+
import { CONSOLE_LINK_DOMAIN, DEV_MODE } from '~/utilities/const';
33

44
const consolePrefix = 'console-openshift-console';
55

66
export const getOpenShiftConsoleServerURL = (apiURL?: string): string | null => {
77
const { hostname, protocol, port } = window.location;
88

99
if (DEV_MODE && apiURL) {
10-
let apiURLWithoutPrefix = apiURL.slice('https://api.'.length);
10+
let apiURLWithoutPrefix = CONSOLE_LINK_DOMAIN || apiURL.slice('https://api.'.length);
1111
if (apiURLWithoutPrefix.includes(':')) {
1212
const [withoutPort] = apiURLWithoutPrefix.split(':');
1313
apiURLWithoutPrefix = withoutPort;

Diff for: frontend/src/utilities/const.ts

+2
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ const { ODH_NOTEBOOK_REPO } = process.env;
2222
const DASHBOARD_CONFIG = process.env.DASHBOARD_CONFIG || 'odh-dashboard-config';
2323
const { EXT_CLUSTER } = process.env;
2424
const { INTERNAL_DASHBOARD_VERSION } = process.env;
25+
const { CONSOLE_LINK_DOMAIN } = process.env;
2526

2627
export {
2728
DEV_MODE,
@@ -39,6 +40,7 @@ export {
3940
WS_HOSTNAME,
4041
EXT_CLUSTER,
4142
INTERNAL_DASHBOARD_VERSION,
43+
CONSOLE_LINK_DOMAIN,
4244
};
4345

4446
export const DOC_TYPE_TOOLTIPS = {

0 commit comments

Comments
 (0)