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

add grafana dashboards to the chart #6381

Closed
bergerx opened this issue Oct 28, 2020 · 37 comments
Closed

add grafana dashboards to the chart #6381

bergerx opened this issue Oct 28, 2020 · 37 comments
Labels
kind/feature Categorizes issue or PR as related to a new feature.

Comments

@bergerx
Copy link

bergerx commented Oct 28, 2020

We'd like to have the grafana dashboards to be installed as part of the helm chart.

The grafana chart already supports defining the dashboards as configmaps using a sidecar (which is also used part of the kube-prometheus-stack chart by default), its described here:
https://github.com/grafana/helm-charts/tree/1f9f9fdf8be5fff63663d121d71dbeaa120ca6ca/charts/grafana#sidecar-for-dashboards

Creation of the grafana dashboards could be enabled based on some flags/configuration in the values file.
Here is an example implementation: https://github.com/helm/charts/blob/0c093133575d640710959d3442d5bad59c776942/stable/sealed-secrets/templates/configmap-dashboards.yaml

I'll try to put together a PR but in the meantime if someone else wants to work on it here is a sample implementation based on the example above

Add these into values.yaml

dashboards:
  # If enabled, ingress-nginx will create a configmap with a dashboard in json that's going to be picked up by grafana
  # See https://github.com/grafana/helm-charts/tree/main/charts/grafana#configuration - `sidecar.dashboards.enabled`
  create: false
  # Extra labels to apply to the dashboard configmaps
  labels:
  # The namespace where the dashboards are deployed, defaults to the installation namespace
  namespace:

And add these to

{{- if .Values.dashboards.create }}
{{- $namespace := .Values.dashboards.namespace | default $.Release.Namespace }}
{{- range $path, $_ :=  .Files.Glob  "../../deploy/grafana/dashboards/*.json" }}
{{- $filename := trimSuffix (ext $path) (base $path) }}
apiVersion: v1
kind: ConfigMap
metadata:
  name: {{ template "ingress-nginx.fullname" $ }}-{{ $filename }}
  namespace: {{ $namespace }}
  labels:
    grafana_dashboard: "1"
    {{- include "ingress-nginx.labels" . | nindent 4 }}
    {{- if $.Values.dashboards.labels }}
    {{- toYaml $.Values.dashboards.labels | nindent 4 }}
    {{- end }}
data:
  {{ base $path }}: |-
{{ $.Files.Get $path | indent 4 }}
---
{{- end }}
{{- end }}

/kind feature

@bergerx bergerx added the kind/feature Categorizes issue or PR as related to a new feature. label Oct 28, 2020
@bergerx
Copy link
Author

bergerx commented Nov 6, 2020

If this seems easy enough to the maintainers, maybe we can mark this as a 'good first issue'?

@fejta-bot
Copy link

Issues go stale after 90d of inactivity.
Mark the issue as fresh with /remove-lifecycle stale.
Stale issues rot after an additional 30d of inactivity and eventually close.

If this issue is safe to close now please do so with /close.

Send feedback to sig-testing, kubernetes/test-infra and/or fejta.
/lifecycle stale

@k8s-ci-robot k8s-ci-robot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Feb 4, 2021
@bergerx
Copy link
Author

bergerx commented Feb 9, 2021

/remove-lifecycle stale

@k8s-ci-robot k8s-ci-robot removed the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Feb 9, 2021
@bergerx
Copy link
Author

bergerx commented Feb 9, 2021

@aledbf, do you mind tagging this as a good-first-issue. I believe there is sufficient amount of information in the description already. Maybe someone picks this up before we revisit this to convert into a pr.

@VengefulAncient
Copy link

This would be really nice to have. IMO, kustomize is hard to maintain and, ironically, customize, compared to Helm charts. (The used approach is also quite outdated, no one wants to deal with NodePorts and kubectl port-forward when ingress exists.)

@antoineozenne
Copy link

It could be great!

@fejta-bot
Copy link

Issues go stale after 90d of inactivity.
Mark the issue as fresh with /remove-lifecycle stale.
Stale issues rot after an additional 30d of inactivity and eventually close.

If this issue is safe to close now please do so with /close.

Send feedback to sig-contributor-experience at kubernetes/community.
/lifecycle stale

@k8s-ci-robot k8s-ci-robot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Jun 6, 2021
@MattJeanes
Copy link

/remove-lifecycle stale

@k8s-ci-robot k8s-ci-robot removed the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Jun 6, 2021
@k8s-triage-robot
Copy link

The Kubernetes project currently lacks enough contributors to adequately respond to all issues and PRs.

This bot triages issues and PRs according to the following rules:

  • After 90d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was applied, the issue is closed

You can:

  • Mark this issue or PR as fresh with /remove-lifecycle stale
  • Mark this issue or PR as rotten with /lifecycle rotten
  • Close this issue or PR with /close
  • Offer to help out with Issue Triage

Please send feedback to sig-contributor-experience at kubernetes/community.

/lifecycle stale

@k8s-ci-robot k8s-ci-robot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Sep 4, 2021
@antoineozenne
Copy link

/remove-lifecycle stale

@k8s-ci-robot k8s-ci-robot removed the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Sep 7, 2021
@k8s-triage-robot
Copy link

The Kubernetes project currently lacks enough contributors to adequately respond to all issues and PRs.

This bot triages issues and PRs according to the following rules:

  • After 90d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was applied, the issue is closed

You can:

  • Mark this issue or PR as fresh with /remove-lifecycle stale
  • Mark this issue or PR as rotten with /lifecycle rotten
  • Close this issue or PR with /close
  • Offer to help out with Issue Triage

Please send feedback to sig-contributor-experience at kubernetes/community.

/lifecycle stale

@k8s-ci-robot k8s-ci-robot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Dec 6, 2021
@antoineozenne
Copy link

/remove-lifecycle stale

@k8s-ci-robot k8s-ci-robot removed the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Dec 6, 2021
@k8s-triage-robot
Copy link

The Kubernetes project currently lacks enough contributors to adequately respond to all issues and PRs.

This bot triages issues and PRs according to the following rules:

  • After 90d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was applied, the issue is closed

You can:

  • Mark this issue or PR as fresh with /remove-lifecycle stale
  • Mark this issue or PR as rotten with /lifecycle rotten
  • Close this issue or PR with /close
  • Offer to help out with Issue Triage

Please send feedback to sig-contributor-experience at kubernetes/community.

/lifecycle stale

@k8s-ci-robot k8s-ci-robot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Mar 6, 2022
@antoineozenne
Copy link

/remove-lifecycle stale

@k8s-ci-robot k8s-ci-robot removed the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Mar 6, 2022
@longwuyuan
Copy link
Contributor

some work was done recently. Please check docs

@antoineozenne
Copy link

some work was done recently. Please check docs

I don't see it. Can you please attach a link?

@longwuyuan
Copy link
Contributor

longwuyuan commented Mar 6, 2022 via email

@VengefulAncient
Copy link

VengefulAncient commented Mar 6, 2022

This is a good start but the original issue stands. The entire Prometheus/Grafana stack with these dashboards needs to be made available as a configurable part of the ingress-nginx Helm chart so it can be properly maintained by devops teams that implement ingress-nginx in their clusters. A manual deployment with kustomize is not a suitable solution. Therefore, this issue should be kept open.

@longwuyuan
Copy link
Contributor

longwuyuan commented Mar 7, 2022 via email

@bergerx
Copy link
Author

bergerx commented Mar 7, 2022

@longwuyuan I see that in the Prometheus and Grafana installation doc, the dashboard json is already hosted in the repo and maintained as part of the ingress-nginx repo already.

Given that the dashboard source code is already part of the repo (which would be the main body that would require significant maintenance overhead over time), delivery of this feature would be adding a couple of manifest files in the chart to include that existing dashboard json file into the released chart. After a couple of PRs to get some more parts parameterized, I'd personally expect this to be one of the most stable parts of the chart given that the maintenance of teh dashboard is already out of the scope of this delivery.

@longwuyuan
Copy link
Contributor

longwuyuan commented Mar 9, 2022 via email

@kfox1111
Copy link

kfox1111 commented Mar 9, 2022

helm supports conditionals. Can just wrap the grafana dashboard in a conditional to enable it if the user wishes in the ingress-nginx chart. No need for a separate chart.

@longwuyuan
Copy link
Contributor

longwuyuan commented Mar 9, 2022 via email

@MattJeanes
Copy link

My understanding is that enabling it would simply put a configmap on the cluster with special labels/annotations which is picked up by a special grafana sidecar container already on the cluster and automatically added into grafana. You can see an example of this here: https://github.com/prometheus-community/helm-charts/blob/main/charts/kube-prometheus-stack/templates/grafana/dashboards-1.14/grafana-overview.yaml

@longwuyuan
Copy link
Contributor

longwuyuan commented Mar 10, 2022 via email

@bergerx
Copy link
Author

bergerx commented Mar 10, 2022

The ingress-nginx chart already has a kind: ServiceMonitor manifest, that can only be used if a prometheus-operator installed and configured to watch that manifest. That manifest tells prometheus-operator to configure prometheus how/where to scrape ingress-nginx metrics.

The proposed manifest here would be a similar addition with some minor differences. This one will tell the grafana chart (which has the mentioned sidecar) to configure the ingress-nginx grafana dashboard. Prometheus-operator decided to use CRDs to pass prometheus configuration but in grafana's case they just picked ConfigMap with a special label over creating a new CRD.

Also most of the helm users deploy prometheus-operator through the kube-prometheus-stack chart, that already depends on the grafana chart that already has the mentioned sidecar that watches such dashboard ConfigMaps.

So, adding support for the dashboard in form of the ConfigMap would be aligned with supporting the kind: ServiceMonitor. In the same way people don't want to deploy the ServiceMonitor manifest by other means, they dont want to do it to deploy the dashboard.

If your concern is not to maintain the dashboard's json as part of the ingress-nginx, unfortunately its already in the repo and not to be added/copied as part of this issue/pr. This PR would just use the existing dashboard json thats already there.

I guess, at this point discussing these on a PR would be more productive for everyone to get the big picture better, I just didn't yet have time to do that yet. And if someone else does that in the meantime i'd really help all.

@longwuyuan
Copy link
Contributor

@bergerx I agree. Makes sense. Requirements are that it has to be optional with default as opt-out. I would love to try this but I have not done it before so if nobody tries for a long time, and I get time, then I will try.

@longwuyuan
Copy link
Contributor

/assign
Sorry for delay on this. I will try to work on this this week.

@longwuyuan
Copy link
Contributor

@bergerx I started looking at this and my thoughts are as follows ;

  • Including pieces for observability has to be optional and not a default opt-in. Because of this bundling the Grafana chart json in a default install of the ingress-nginx-controller chart is not my choice. Others may differ
  • Just as controller.metrics.enabled is an optional key, using an optional key like controller.metrics.grafana.dashboard.enabled seems like the expected direction this should take
  • This requires a lot of work, specially on testing, so you can submit a PR

@longwuyuan longwuyuan removed their assignment Apr 13, 2022
@k8s-triage-robot
Copy link

The Kubernetes project currently lacks enough contributors to adequately respond to all issues and PRs.

This bot triages issues and PRs according to the following rules:

  • After 90d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was applied, the issue is closed

You can:

  • Mark this issue or PR as fresh with /remove-lifecycle stale
  • Mark this issue or PR as rotten with /lifecycle rotten
  • Close this issue or PR with /close
  • Offer to help out with Issue Triage

Please send feedback to sig-contributor-experience at kubernetes/community.

/lifecycle stale

@k8s-ci-robot k8s-ci-robot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Jul 12, 2022
@MattJeanes
Copy link

I believe this is still a valuable addition to the chart

/remove-lifecycle stale

@k8s-ci-robot k8s-ci-robot removed the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Jul 12, 2022
@k8s-triage-robot
Copy link

The Kubernetes project currently lacks enough contributors to adequately respond to all issues and PRs.

This bot triages issues and PRs according to the following rules:

  • After 90d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was applied, the issue is closed

You can:

  • Mark this issue or PR as fresh with /remove-lifecycle stale
  • Mark this issue or PR as rotten with /lifecycle rotten
  • Close this issue or PR with /close
  • Offer to help out with Issue Triage

Please send feedback to sig-contributor-experience at kubernetes/community.

/lifecycle stale

@k8s-ci-robot k8s-ci-robot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Oct 10, 2022
@antoineozenne
Copy link

/remove-lifecycle stale

@k8s-ci-robot k8s-ci-robot removed the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Oct 10, 2022
@rikatz
Copy link
Contributor

rikatz commented Jun 29, 2023

Is there a PR on it?
We should probably have helm chart running independently of main ingress code, but remember that also we had recent complains that our helm charts are getting too complicated to maintain.

I'm not against a PR for this, honestly, but I would like to:

  • Have the configmap being generated during helm release, and not copied/pasted as a configmap generating one more huge configmap file template on our chart
  • Have conditionals and disable by default
  • As we use Prometheus Operator manifests (we shouldn't IMO, but it is what it is) we should try to stick with this approach

@tao12345666333
Copy link
Member

We can create a new child helm chart for this one.
If users want to enable this child helm chart, then it will generate the configmap includes all Grafana dashboard.

@rikatz
Copy link
Contributor

rikatz commented Feb 28, 2024

/close

We are trying not to overload (more) helm charts. I would love to have some community maintained helm chart for grafana dashboards, but right now I think this is a burden we cannot maintain on the project.

@k8s-ci-robot
Copy link
Contributor

@rikatz: Closing this issue.

In response to this:

/close

We are trying not to overload (more) helm charts. I would love to have some community maintained helm chart for grafana dashboards, but right now I think this is a burden we cannot maintain on the project.

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/test-infra repository.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/feature Categorizes issue or PR as related to a new feature.
Projects
None yet
Development

No branches or pull requests