grafana / grafana-operator

An operator for Grafana that installs and manages Grafana instances, Dashboards and Datasources through Kubernetes/OpenShift CRs
https://grafana.github.io/grafana-operator/
Apache License 2.0
913 stars 397 forks source link

[GrafanaDashboard] operator fails to create a dashboard with hardcoded id #1108

Closed anushanagireddy0430 closed 1 year ago

anushanagireddy0430 commented 1 year ago

Unable to see dashboard created using GrafanaDashbord CR in grafana UI.

operator v5.0.0, grafana 9.5.2

Steps to reproduce the behavior:

  1. Install v5 operator in namespace1 as cluster based operator to watch all namespaces
  2. Deploy grafana in namespace2
  3. Deploy grafanadashboard CR in namespace2 with gZipJson method
  4. View for operator logs, Dashboard not found error is coming, but folder got created in Grafana.

Grafana dashboard should be visible

weisdd commented 1 year ago

@anushanagireddy0430 please, don't forget to revoke client secret (it's exposed in one of your files).

weisdd commented 1 year ago

@anushanagireddy0430 as for the dashboard not being added, your json contains "id": 13, whereas it should have been set to "id": null,, so when the operator tries to create or overwrite the dashboard in Grafana, Grafana simply says that it has no idea what the dashboard with id 13 is, operator just prints that response in logs. So, strictly speaking, you have incorrect json. Though, we can consider nullifying id on the fly.

@pb82 @HubertStefanski @NissesSenap WDYT?

anushanagireddy0430 commented 1 year ago

Thanks @weisdd It worked after correcting Json. Didnt think of Checking Json data as same json worked with different grafana instances even though id is not kept null in v4 versions of grafana.

anushanagireddy0430 commented 1 year ago

Hi @weisdd @NissesSenap

I have observed that I am able to see dashboard created using CRD in Grafana UI only when it was deployed to namespace where Grafana is deployed. Right now I have deployed cluster scoped operator in one namespace and Grafana in separate namespace. I am unable to find what's wrong with configuration. `apiVersion: apps/v1 kind: Deployment metadata: annotations: deployment.kubernetes.io/revision: "1" meta.helm.sh/release-name: ecs-central-grafana-operator meta.helm.sh/release-namespace: ecs-operators creationTimestamp: "2023-06-22T07:27:31Z" generation: 1 labels: app.kubernetes.io/instance: ecs-central-grafana-operator app.kubernetes.io/managed-by: Helm app.kubernetes.io/name: ecs-central-grafana-operator app.kubernetes.io/version: v5.0.1 filebeat-logs: enabled helm.sh/chart: ecs-grafana-operator-helmcharts-5.0.1 name: ecs-central-grafana-operator namespace: ecs-operators resourceVersion: "12630207" uid: acbc0b7f-c4f4-4d95-87bf-15c467ea02ab spec: progressDeadlineSeconds: 600 replicas: 1 revisionHistoryLimit: 10 selector: matchLabels: app.kubernetes.io/instance: ecs-central-grafana-operator app.kubernetes.io/name: ecs-central-grafana-operator strategy: rollingUpdate: maxSurge: 25% maxUnavailable: 25% type: RollingUpdate template: metadata: creationTimestamp: null labels: app.kubernetes.io/instance: ecs-central-grafana-operator app.kubernetes.io/name: ecs-central-grafana-operator spec: containers:

Help me understand!

NissesSenap commented 1 year ago

@anushanagireddy0430 it's unreadable the way you have posted your issue. I would reach out in our slack channel or create a new issue, please keep posting in closed cases to a minimum. When you do, make sure that your yaml looks okay and provide the grafana and grafanadashboard CR, not the deployment.