Skip to content

Commit

Permalink
Create consoleLinkDomain ENV Var
Browse files Browse the repository at this point in the history
  • Loading branch information
dpanshug committed Nov 8, 2024
1 parent 30440ec commit a079729
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 13 deletions.
3 changes: 2 additions & 1 deletion backend/src/utils/prometheusUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,8 @@ const generatePrometheusHostURL = (
): string => {
if (DEV_MODE) {
const apiPath = fastify.kube.config.getCurrentCluster().server;
const namedHost = apiPath.slice('https://api.'.length).split(':')[0];
const namedHost =
process.env.CONSOLE_LINK_DOMAIN || apiPath.slice('https://api.'.length).split(':')[0];
return `https://${instanceName}-${namespace}.apps.${namedHost}`;
}
return `https://${instanceName}.${namespace}.svc.cluster.local:${port}`;
Expand Down
38 changes: 27 additions & 11 deletions docs/dev-setup.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,13 @@ ODH requires the following to run:
## Development

1. Clone the repository
``` bash
git clone https://github.com/opendatahub-io/odh-dashboard
```
```bash
git clone https://github.com/opendatahub-io/odh-dashboard
```
2. Within the repo context, install project dependencies
```bash
cd odh-dashboard && npm install
```
```bash
cd odh-dashboard && npm install
```

### Build project

Expand All @@ -34,7 +34,7 @@ npm run build

### Serve development content

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.
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.

> 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).

Expand All @@ -52,9 +52,9 @@ For in-depth local run guidance review the [contribution guidelines](../CONTRIBU
Run the tests.
```bash
npm run test
```
```bash
npm run test
```
For in-depth testing guidance review the [testing guidelines](./testing.md)
Expand All @@ -64,13 +64,29 @@ Feature flags are defined in the [dashboard config](./dashboard-config.md#featur
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.
### Configuring Custom Console Link Domain (CONSOLE_LINK_DOMAIN)
Certain environments, like ROSA and IBM clusters, 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.
Steps to Configure:
1. Open the root `.env.local` file (or create it if it doesn't exist).
2. Add the following line to define the custom console domain:

<code>CONSOLE_LINK_DOMAIN=your-custom-domain.com</code>

3. Replace your-custom-domain.com with the specific domain for your OpenShift console, for example:

- `apps.cluster-rosa.aws.openshift.com` for ROSA clusters
- `apps.cluster.ibm.openshift.com` for IBM clusters

## Deploying the ODH Dashbard

### Official Image Builds

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>`.

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.
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.

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.

Expand Down
3 changes: 2 additions & 1 deletion frontend/src/utilities/clusterUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ export const getOpenShiftConsoleServerURL = (apiURL?: string): string | null =>
const { hostname, protocol, port } = window.location;

if (DEV_MODE && apiURL) {
let apiURLWithoutPrefix = apiURL.slice('https://api.'.length);
let apiURLWithoutPrefix =
process.env.CONSOLE_LINK_DOMAIN || apiURL.slice('https://api.'.length);
if (apiURLWithoutPrefix.includes(':')) {
const [withoutPort] = apiURLWithoutPrefix.split(':');
apiURLWithoutPrefix = withoutPort;
Expand Down

0 comments on commit a079729

Please sign in to comment.