Skip to content

Commit

Permalink
move public and private dashboards to separate sub-charts
Browse files Browse the repository at this point in the history
  • Loading branch information
hervenicol committed Oct 10, 2023
1 parent a3652f5 commit 2a7363b
Show file tree
Hide file tree
Showing 91 changed files with 111 additions and 47 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]


### Changed

- Update Loki Cost Estimation dashboard.
- [BREAKING] Split the chart in sub-chart to get around chart size limitation - all values are moved to a `global` section.

## [2.46.0] - 2023-10-09

Expand Down
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,14 @@ This project currently contains Giant Swarm public dashboards.

The goal of this repository is to have both public and Grafana Cloud dashboards defined in one place and in the same format.

## Sub-charts

This chart is divided in 4 different charts, to get around helm charts size limitations:
- `helm/dashboards/charts/public_dashboards/` for public dashboards.
- `helm/dashboards/charts/private_dashboards_al/` for private dashboards starting with letters A to L.
- `helm/dashboards/charts/private_dashboards_mz/` for private dashboards starting with letters M to Z.
- `helm/dashboards/` for other dashboards.

## Management cluster's dashboards

The dashboards located under `helm/dashboards` are the dashboards hosted on each management cluster's grafana.
Expand Down
12 changes: 12 additions & 0 deletions helm/dashboards/Chart.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
dependencies:
- name: public_dashboards
repository: ""
version: 1.0.0
- name: private_dashboards_al
repository: ""
version: 1.0.0
- name: private_dashboards_mz
repository: ""
version: 1.0.0
digest: sha256:70e15e8c0291ae2b93b05321e0c909ee9987dcb5c2149aa1d61093555a12c331
generated: "2023-10-09T17:22:22.796321595+02:00"
7 changes: 7 additions & 0 deletions helm/dashboards/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,10 @@ version: [[ .Version ]]
annotations:
application.giantswarm.io/team: "atlas"
config.giantswarm.io/version: 1.x.x
dependencies:
- name: public_dashboards
version: 1.0.0
- name: private_dashboards_al
version: 1.0.0
- name: private_dashboards_mz
version: 1.0.0
11 changes: 11 additions & 0 deletions helm/dashboards/charts/private_dashboards_al/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
apiVersion: v2
description: Grafana dashboards accessible by Giant Swarm staff, A to L
engine: gotpl
home: https://github.com/giantswarm/dashboards
icon: https://s.giantswarm.io/app-icons/grafana/1/light.svg
name: private_dashboards_al
appVersion: 1.0.0
version: 1.0.0
annotations:
application.giantswarm.io/team: "atlas"
config.giantswarm.io/version: 1.x.x
11 changes: 11 additions & 0 deletions helm/dashboards/charts/private_dashboards_mz/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
apiVersion: v2
description: Grafana dashboards accessible by Giant Swarm staff, M to Z
engine: gotpl
home: https://github.com/giantswarm/dashboards
icon: https://s.giantswarm.io/app-icons/grafana/1/light.svg
name: private_dashboards_mz
appVersion: 1.0.0
version: 1.0.0
annotations:
application.giantswarm.io/team: "atlas"
config.giantswarm.io/version: 1.x.x
11 changes: 11 additions & 0 deletions helm/dashboards/charts/public_dashboards/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
apiVersion: v2
description: Grafana dashboards accessible by Giant Swarm customers
engine: gotpl
home: https://github.com/giantswarm/dashboards
icon: https://s.giantswarm.io/app-icons/grafana/1/light.svg
name: public_dashboards
appVersion: 1.0.0
version: 1.0.0
annotations:
application.giantswarm.io/team: "atlas"
config.giantswarm.io/version: 1.x.x
2 changes: 1 addition & 1 deletion helm/dashboards/dashboards/home.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
},
"id": 6,
"options": {
"content": "<div style=\"color: #fff; padding: 30px; height: 100%; background: no-repeat url(https://user-images.githubusercontent.com/273727/122764477-cc0d7880-d29f-11eb-9379-62a551323b32.png); background-size: cover; background-position: center top 50%\">\n<div style=\"line-height: 55px\">\n<img src=\"https://s.giantswarm.io/brand/1/logo-white.svg\" style=\"display: inline-block; width: 220px; height: 55px; margin-bottom: 13px; margin-left: -15px; padding-right: 20px;\"/>\n<span class=\"h1\" style=\"display: inline-block; padding-top: 15px; margin-bottom: 0; line-height: 20px\">Grafana Dashboards</span>\n</div>\n<p>Open the <b>Dashboards</b> / <b>Manage</b> menu on the left to find all dashboards, or select one from below:</p>\n<ul>\n{{- range $index, $link := $.Values.home.urls -}}{{- if or (eq $link.provider "shared") (eq $link.provider $.Values.provider.kind) }}<li><b><a href=\"{{ $link.link }}\">{{ $link.name }}</a></b>: {{ $link.description }}.</li>\n{{- end -}}{{- end -}}</ul>\n<p>Learn more about this Grafana instance capabilities by reading some of our documentations:</p>\n<ul>\n{{- range $index, $link := $.Values.home.documentation -}}<li><b><a href=\"{{ $link.link }}\">{{ $link.name }}</a></b>: {{ $link.description }}.</li>\n{{- end -}}</ul>\n</div>",
"content": "<div style=\"color: #fff; padding: 30px; height: 100%; background: no-repeat url(https://user-images.githubusercontent.com/273727/122764477-cc0d7880-d29f-11eb-9379-62a551323b32.png); background-size: cover; background-position: center top 50%\">\n<div style=\"line-height: 55px\">\n<img src=\"https://s.giantswarm.io/brand/1/logo-white.svg\" style=\"display: inline-block; width: 220px; height: 55px; margin-bottom: 13px; margin-left: -15px; padding-right: 20px;\"/>\n<span class=\"h1\" style=\"display: inline-block; padding-top: 15px; margin-bottom: 0; line-height: 20px\">Grafana Dashboards</span>\n</div>\n<p>Open the <b>Dashboards</b> / <b>Manage</b> menu on the left to find all dashboards, or select one from below:</p>\n<ul>\n{{- range $index, $link := $.Values.global.home.urls -}}{{- if or (eq $link.provider "shared") (eq $link.provider $.Values.global.provider.kind) }}<li><b><a href=\"{{ $link.link }}\">{{ $link.name }}</a></b>: {{ $link.description }}.</li>\n{{- end -}}{{- end -}}</ul>\n<p>Learn more about this Grafana instance capabilities by reading some of our documentations:</p>\n<ul>\n{{- range $index, $link := $.Values.global.home.documentation -}}<li><b><a href=\"{{ $link.link }}\">{{ $link.name }}</a></b>: {{ $link.description }}.</li>\n{{- end -}}</ul>\n</div>",
"mode": "html"
},
"pluginVersion": "8.0.3",
Expand Down
6 changes: 3 additions & 3 deletions helm/dashboards/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@ Common labels
{{- define "labels.common" -}}
app.kubernetes.io/name: {{ include "name" . | quote }}
app.kubernetes.io/instance: {{ $.Release.Name | quote }}
app.giantswarm.io/branch: {{ $.Values.project.branch | replace "#" "-" | replace "/" "-" | replace "." "-" | trunc 63 | trimSuffix "-" | quote }}
app.giantswarm.io/commit: {{ $.Values.project.commit | quote }}
app.giantswarm.io/branch: {{ $.Values.global.project.branch | replace "#" "-" | replace "/" "-" | replace "." "-" | trunc 63 | trimSuffix "-" | quote }}
app.giantswarm.io/commit: {{ $.Values.global.project.commit | quote }}
app.kubernetes.io/managed-by: {{ $.Release.Service | quote }}
app.kubernetes.io/version: {{ $.Chart.AppVersion | quote }}
helm.sh/chart: {{ include "chart" . | quote }}
giantswarm.io/service-type: {{ $.Values.serviceType }}
giantswarm.io/service-type: {{ $.Values.global.serviceType }}
app.giantswarm.io/kind: "dashboard"
{{- end -}}
24 changes: 12 additions & 12 deletions helm/dashboards/templates/configmap-dashboards.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ items:
labels:
{{- include "labels.common" $ | nindent 6 }}
name: grafana-home-dashboard
namespace: {{ $.Values.namespace }}
namespace: {{ $.Values.global.namespace }}
data:
home.json: {{ (tpl ($.Files.Get "dashboards/home.json") .) | quote }}
## Mixins dashboards
Expand All @@ -24,7 +24,7 @@ items:
labels:
{{- include "labels.common" $ | nindent 6 }}
name: {{ printf "grafana-mixin-%s-dashboard" $dashboardName | trunc 63 | trimSuffix "-" }}
namespace: {{ $.Values.namespace }}
namespace: {{ $.Values.global.namespace }}
data:
{{ $dashboardName }}.json: {{ $.Files.Get $path | toJson }}
{{- end }}
Expand All @@ -39,7 +39,7 @@ items:
labels:
{{- include "labels.common" $ | nindent 6 }}
name: {{ printf "grafana-shared-%s-dashboard" $dashboardName | trunc 63 | trimSuffix "-" }}
namespace: {{ $.Values.namespace }}
namespace: {{ $.Values.global.namespace }}
data:
{{ $dashboardName }}.json: {{ $.Files.Get $path | toJson }}
{{- end }}
Expand All @@ -54,37 +54,37 @@ items:
labels:
{{- include "labels.common" $ | nindent 6 }}
name: {{ printf "grafana-shared-%s-dashboard" $dashboardName | trunc 63 | trimSuffix "-" }}
namespace: {{ $.Values.namespace }}
namespace: {{ $.Values.global.namespace }}
data:
{{ $dashboardName }}.json: {{ $.Files.Get $path | toJson }}
{{- end }}
## Provider specific public dashboards
{{- range $path, $fileContents := $.Files.Glob (printf "dashboards/%s/public/*.json" $.Values.provider.kind) }}
{{- range $path, $fileContents := $.Files.Glob (printf "dashboards/%s/public/*.json" $.Values.global.provider.kind) }}
{{- $dashboardName := regexReplaceAll "(^.*/)(.*)\\.json$" $path "${2}" }}
- apiVersion: v1
kind: ConfigMap
metadata:
annotations:
k8s-sidecar-target-directory: "/var/lib/grafana/dashboards/public/{{ $.Values.provider.kind }}"
k8s-sidecar-target-directory: "/var/lib/grafana/dashboards/public/{{ $.Values.global.provider.kind }}"
labels:
{{- include "labels.common" $ | nindent 6 }}
name: {{ printf "grafana-%s-%s-dashboard" $.Values.provider.kind $dashboardName | trunc 63 | trimSuffix "-" }}
namespace: {{ $.Values.namespace }}
name: {{ printf "grafana-%s-%s-dashboard" $.Values.global.provider.kind $dashboardName | trunc 63 | trimSuffix "-" }}
namespace: {{ $.Values.global.namespace }}
data:
{{ $dashboardName }}.json: {{ $.Files.Get $path | toJson }}
{{- end }}
## Provider specific private dashboards
{{- range $path, $fileContents := $.Files.Glob (printf "dashboards/%s/private/*.json" $.Values.provider.kind) }}
{{- range $path, $fileContents := $.Files.Glob (printf "dashboards/%s/private/*.json" $.Values.global.provider.kind) }}
{{- $dashboardName := regexReplaceAll "(^.*/)(.*)\\.json$" $path "${2}" }}
- apiVersion: v1
kind: ConfigMap
metadata:
annotations:
k8s-sidecar-target-directory: "/var/lib/grafana/dashboards/private/{{ $.Values.provider.kind }}"
k8s-sidecar-target-directory: "/var/lib/grafana/dashboards/private/{{ $.Values.global.provider.kind }}"
labels:
{{- include "labels.common" $ | nindent 6 }}
name: {{ printf "grafana-%s-%s-dashboard" $.Values.provider.kind $dashboardName | trunc 63 | trimSuffix "-" }}
namespace: {{ $.Values.namespace }}
name: {{ printf "grafana-%s-%s-dashboard" $.Values.global.provider.kind $dashboardName | trunc 63 | trimSuffix "-" }}
namespace: {{ $.Values.global.namespace }}
data:
{{ $dashboardName }}.json: {{ $.Files.Get $path | toJson }}
{{- end }}
61 changes: 31 additions & 30 deletions helm/dashboards/values.yaml
Original file line number Diff line number Diff line change
@@ -1,33 +1,34 @@
name: dashboards
namespace: monitoring
serviceType: managed
global:
name: dashboards
namespace: monitoring
serviceType: managed

project:
branch: "[[ .Branch ]]"
commit: "[[ .SHA ]]"
project:
branch: "[[ .Branch ]]"
commit: "[[ .SHA ]]"

home:
urls:
- name: "Alerts"
link: "/d/L65Jdq3Zk/alerts"
description: "find out which alerts are currently active for an installation, and see which are overruled by silences or inhibitions"
provider: "shared"
- name: "Managed apps"
link: "/d/O74c1gI7k/managed-apps"
description: "find out which managed apps are installed for an installation"
provider: "shared"
- name: "Nodes overview"
link: "/d/qMN01qkWz/nodes-overview"
description: "basic metrics on the nodes in your Kubernetes clusters"
provider: "shared"
- name: "KVM Resource Usage"
link: "/d/kjQlHcWnk/kvm-resource-usage"
description: "resource usage of the KVM cluster"
provider: "kvm"
documentation:
- name: "Custom dashboards"
link: "https://docs.giantswarm.io/getting-started/observability/grafana/custom-dashboards/"
description: "Add your own custom dashboards to this Grafana"
home:
urls:
- name: "Alerts"
link: "/d/L65Jdq3Zk/alerts"
description: "find out which alerts are currently active for an installation, and see which are overruled by silences or inhibitions"
provider: "shared"
- name: "Managed apps"
link: "/d/O74c1gI7k/managed-apps"
description: "find out which managed apps are installed for an installation"
provider: "shared"
- name: "Nodes overview"
link: "/d/qMN01qkWz/nodes-overview"
description: "basic metrics on the nodes in your Kubernetes clusters"
provider: "shared"
- name: "KVM Resource Usage"
link: "/d/kjQlHcWnk/kvm-resource-usage"
description: "resource usage of the KVM cluster"
provider: "kvm"
documentation:
- name: "Custom dashboards"
link: "https://docs.giantswarm.io/getting-started/observability/grafana/custom-dashboards/"
description: "Add your own custom dashboards to this Grafana"

provider:
kind: ""
provider:
kind: ""

0 comments on commit 2a7363b

Please sign in to comment.