Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] Operator does not correctly import dashboards with variables #1303

Closed
bheading opened this issue Nov 8, 2023 · 8 comments
Closed

[Bug] Operator does not correctly import dashboards with variables #1303

bheading opened this issue Nov 8, 2023 · 8 comments
Labels
bug Something isn't working needs triage Indicates an issue or PR lacks a `triage/foo` label and requires one. stale

Comments

@bheading
Copy link

bheading commented Nov 8, 2023

*Description

The Operator does not correctly set up a variable defined in the __inputs section of a dashboard

Version
v5.4.2

To Reproduce
Steps to reproduce the behavior:

  1. Set up a Grafana instance on kind in the usual way.

  2. use kubectl apply -f to apply the attached dashboard : test-dashboard.yaml.gz

  3. Log into Grafana and notice that the panel shows ${VAR_TESTCONSTANT} instead of the expected value example-constant.

Expected behavior

When Grafana is importing the dashboard it should inflate the variables within the __inputs section.

Screenshots

Expected outcome :

image

Observed outcome :

image

Runtime (please complete the following information):

  • OS: Fedora 38
  • v5.4.2
  • Environment: kind 0.20.0/kubernetes1.27.3
  • Deployment type: local
@bheading bheading added bug Something isn't working needs triage Indicates an issue or PR lacks a `triage/foo` label and requires one. labels Nov 8, 2023
@R-Studio
Copy link

Same issue here with Grafana-Operator v5.4.1 and Grafana v10.1.4.

@pb82
Copy link
Collaborator

pb82 commented Nov 28, 2023

@bheading isn't __inputs used for specifying data sources? Also, should the values reference environment variables?

@R-Studio
Copy link

@pb82 But if so, how can we overwrite template variables in Grafana dashboards with the operator?
@NissesSenap Do you have any idea?

@ciomaire
Copy link

Its possible to use grafanadashboard.spec.datasources to map a value to a constant defined in __inputs

Not sure if this if is an officially recommended approach though, it would be preferable not to have to reference a field named datasourceName.

--- test-dashboard.yaml 2023-12-19 10:43:02.693241401 +0100
+++ test-dashboard2.yaml        2023-12-19 11:12:39.567848239 +0100
@@ -6,9 +6,9 @@
   instanceSelector:
     matchLabels:
       dashboards: grafana-a
-  envs:
-    - name: VAR_TESTCONSTANT
-      value: foobar
+  datasources:
+    - inputName: VAR_TESTCONSTANT
+      datasourceName: foobar
   json: |
     {
       "__inputs": [

@NissesSenap
Copy link
Collaborator

I currently don't have time to take a deeper look, at this.
But I would recommend looking at the documentation. That is working last time I looked.

Copy link

This issue hasn't been updated for a while, marking as stale, please respond within the next 7 days to remove this label

@github-actions github-actions bot added the stale label Jan 19, 2024
@R-Studio
Copy link

R-Studio commented Jan 25, 2024

/remove-lifecycle stale
This is still a issue but there is a workaround, thanks to @ciomaire

@github-actions github-actions bot removed the stale label Jan 26, 2024
Copy link

This issue hasn't been updated for a while, marking as stale, please respond within the next 7 days to remove this label

@github-actions github-actions bot added the stale label Feb 25, 2024
@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Mar 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working needs triage Indicates an issue or PR lacks a `triage/foo` label and requires one. stale
Projects
None yet
Development

No branches or pull requests

5 participants