Skip to content

COO-1776: fix: throw error for unsupported dashboard level datasources#948

Merged
openshift-merge-bot[bot] merged 1 commit into
openshift:mainfrom
jgbernalp:throw-error-on-dashboard-level-datasources
May 18, 2026
Merged

COO-1776: fix: throw error for unsupported dashboard level datasources#948
openshift-merge-bot[bot] merged 1 commit into
openshift:mainfrom
jgbernalp:throw-error-on-dashboard-level-datasources

Conversation

@jgbernalp
Copy link
Copy Markdown
Contributor

@jgbernalp jgbernalp commented May 18, 2026

Screenshot 2026-05-18 at 14 09 42

Summary by CodeRabbit

  • Bug Fixes
    • Dashboard-level datasources are no longer allowed in OpenShift environments; attempting to use one now shows a clear error message instructing users to configure a project- or global-level datasource instead.
    • Updated console warning text to correctly indicate when no matching global datasource is found, reducing confusion during datasource lookup.

@jgbernalp jgbernalp requested review from PeterYurkovich and zhuje May 18, 2026 12:12
@openshift-ci-robot openshift-ci-robot added the jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. label May 18, 2026
@openshift-ci-robot
Copy link
Copy Markdown

openshift-ci-robot commented May 18, 2026

@jgbernalp: This pull request references COO-1776 which is a valid jira issue.

Warning: The referenced jira issue has an invalid target version for the target branch this PR targets: expected the bug to target the "5.0.0" version, but no target version was set.

Details

In response to this:

Screenshot 2026-05-18 at 14 09 42

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository.

@jgbernalp
Copy link
Copy Markdown
Contributor Author

/cherry-pick release-coo-ocp-4.22

@openshift-cherrypick-robot
Copy link
Copy Markdown

@jgbernalp: once the present PR merges, I will cherry-pick it on top of release-coo-ocp-4.22 in a new PR and assign it to you.

Details

In response to this:

/cherry-pick release-coo-ocp-4.22

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@jgbernalp
Copy link
Copy Markdown
Contributor Author

/cherry-pick release-coo-ocp-4.19

@openshift-cherrypick-robot
Copy link
Copy Markdown

@jgbernalp: once the present PR merges, I will cherry-pick it on top of release-coo-ocp-4.19 in a new PR and assign it to you.

Details

In response to this:

/cherry-pick release-coo-ocp-4.19

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@jgbernalp
Copy link
Copy Markdown
Contributor Author

/cherry-pick release-coo-ocp-4.15

@openshift-cherrypick-robot
Copy link
Copy Markdown

@jgbernalp: once the present PR merges, I will cherry-pick it on top of release-coo-ocp-4.15 in a new PR and assign it to you.

Details

In response to this:

/cherry-pick release-coo-ocp-4.15

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@openshift-ci openshift-ci Bot requested a review from etmurasaki May 18, 2026 12:14
@openshift-ci openshift-ci Bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label May 18, 2026
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 18, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository YAML (base), Central YAML (inherited)

Review profile: CHILL

Plan: Enterprise

Run ID: d35de17d-db03-4cd5-8e48-29976a39f52a

📥 Commits

Reviewing files that changed from the base of the PR and between b9ece44 and 3ea5e22.

📒 Files selected for processing (1)
  • web/src/components/dashboards/perses/datasource-api.ts
🚧 Files skipped from review as they are similar to previous changes (1)
  • web/src/components/dashboards/perses/datasource-api.ts

Walkthrough

This PR prevents constructing dashboard-level datasource proxy URLs in OpenShift by throwing an explicit error in buildProxyUrl, and it updates a console warning in getGlobalDatasource to correctly state “No matching global datasource found”.

Changes

Datasource API Validation

Layer / File(s) Summary
Datasource level validation and warning text
web/src/components/dashboards/perses/datasource-api.ts
buildProxyUrl throws an explicit Error when called with a dashboard (dashboard-level datasources unsupported in OpenShift). getGlobalDatasource console warning text changed to “No matching global datasource found” when no global datasources match.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

🚥 Pre-merge checks | ✅ 12
✅ Passed checks (12 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: throwing an error for unsupported dashboard-level datasources in OpenShift, which directly matches the code change in the pull request.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Stable And Deterministic Test Names ✅ Passed No Ginkgo tests found in this codebase. Repository uses Jest (TypeScript/JavaScript) and standard Go testing package. The check for Ginkgo test naming is not applicable.
Test Structure And Quality ✅ Passed PR modifies only datasource-api.ts with no test changes. Custom check reviews Ginkgo test quality. No Ginkgo tests found in repo or affected by this PR. Check is not applicable.
Microshift Test Compatibility ✅ Passed This PR modifies a TypeScript web component and does not add Ginkgo e2e tests. The check for MicroShift test compatibility is not applicable as it targets e2e tests only.
Single Node Openshift (Sno) Test Compatibility ✅ Passed No Ginkgo e2e tests are added in this PR. Changes are only to a TypeScript web component file (datasource-api.ts). The check is not applicable.
Topology-Aware Scheduling Compatibility ✅ Passed PR modifies only frontend TypeScript code in a web dashboard component. No deployment manifests, operator code, or Kubernetes controllers are modified. No scheduling constraints are introduced.
Ote Binary Stdout Contract ✅ Passed PR modifies TypeScript web components and Go backend code. Go code uses logrus v1.9.3 (defaults to stderr). No process-level stdout writes found in main(), init(), or setup code.
Ipv6 And Disconnected Network Test Compatibility ✅ Passed No Ginkgo e2e tests were added in this PR. The PR adds pkg/server_test.go using Go's standard testing framework and testify/require, plus TypeScript unit tests. This check is not applicable.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@web/src/components/dashboards/perses/datasource-api.ts`:
- Around line 42-44: Update the thrown Error message in the throw new Error(...)
statement so the subject and verb agree and improve clarity: change "Dashboard
level datasource are not supported in OpenShift, please use a project or global
level datasource" to a grammatically correct sentence such as "Dashboard-level
datasources are not supported in OpenShift; please use a project- or
global-level datasource." Ensure you edit the exact string inside the throw new
Error call (the error message in datasource-api.ts) and preserve punctuation and
casing as shown.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository YAML (base), Central YAML (inherited)

Review profile: CHILL

Plan: Enterprise

Run ID: 93113838-de89-45c3-9e71-0a8d1c568f51

📥 Commits

Reviewing files that changed from the base of the PR and between 095e065 and b9ece44.

📒 Files selected for processing (1)
  • web/src/components/dashboards/perses/datasource-api.ts

Comment thread web/src/components/dashboards/perses/datasource-api.ts
Signed-off-by: Gabriel Bernal <gbernal@redhat.com>
@jgbernalp jgbernalp force-pushed the throw-error-on-dashboard-level-datasources branch from b9ece44 to 3ea5e22 Compare May 18, 2026 13:20
@PeterYurkovich
Copy link
Copy Markdown
Contributor

/lgtm

@openshift-ci openshift-ci Bot added the lgtm Indicates that a PR is ready to be merged. label May 18, 2026
@openshift-ci
Copy link
Copy Markdown
Contributor

openshift-ci Bot commented May 18, 2026

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: jgbernalp, PeterYurkovich

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:
  • OWNERS [PeterYurkovich,jgbernalp]

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@jgbernalp
Copy link
Copy Markdown
Contributor Author

/label qe-approved
to be checked with COO

@openshift-ci openshift-ci Bot added the qe-approved Signifies that QE has signed off on this PR label May 18, 2026
@etmurasaki
Copy link
Copy Markdown
Contributor

tested:
image
image

under spec:
"datasources": {
"my-local-prometheus": {
"plugin": {
"kind": "Prometheus",
"spec": {
"directUrl": "http://prometheus-operated.monitoring.svc:9090"
}
}
}
},

@etmurasaki
Copy link
Copy Markdown
Contributor

/label qe-approved

@openshift-ci
Copy link
Copy Markdown
Contributor

openshift-ci Bot commented May 18, 2026

@jgbernalp: all tests passed!

Full PR test history. Your PR dashboard.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here.

@openshift-merge-bot openshift-merge-bot Bot merged commit 2647b58 into openshift:main May 18, 2026
10 checks passed
@openshift-cherrypick-robot
Copy link
Copy Markdown

@jgbernalp: new pull request created: #953

Details

In response to this:

/cherry-pick release-coo-ocp-4.22

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@openshift-cherrypick-robot
Copy link
Copy Markdown

@jgbernalp: new pull request created: #954

Details

In response to this:

/cherry-pick release-coo-ocp-4.19

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@openshift-cherrypick-robot
Copy link
Copy Markdown

@jgbernalp: new pull request created: #955

Details

In response to this:

/cherry-pick release-coo-ocp-4.15

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. lgtm Indicates that a PR is ready to be merged. qe-approved Signifies that QE has signed off on this PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants