Skip to content

Commit

Permalink
fix-missing provider specific dashboards (#555)
Browse files Browse the repository at this point in the history
Signed-off-by: QuentinBisson <[email protected]>
  • Loading branch information
QuentinBisson authored May 29, 2024
1 parent ea0cb8d commit b9763bd
Show file tree
Hide file tree
Showing 6 changed files with 45 additions and 26 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

- Move SLO reporting dashboard to be public.

### Fixed

- Fix missing provider specific dashboards.

### Removed

- Remove EFK dashboards.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,3 @@ items:
data:
{{ $dashboardName }}.json: {{ $.Files.Get $path | toJson }}
{{- end }}
## Provider specific public dashboards
{{- 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.global.provider.kind }}"
labels:
{{- include "labels.common" $ | nindent 6 }}
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 }}
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.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>",
"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.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
30 changes: 30 additions & 0 deletions helm/dashboards/templates/configmap-dashboards.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,33 @@ items:
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) }}
{{- $dashboardName := regexReplaceAll "(^.*/)(.*)\\.json$" $path "${2}" }}
- apiVersion: v1
kind: ConfigMap
metadata:
annotations:
k8s-sidecar-target-directory: "/var/lib/grafana/dashboards/public/{{ $.Values.provider.kind }}"
labels:
{{- include "labels.common" $ | nindent 6 }}
name: {{ printf "grafana-%s-%s-dashboard" $.Values.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) }}
{{- $dashboardName := regexReplaceAll "(^.*/)(.*)\\.json$" $path "${2}" }}
- apiVersion: v1
kind: ConfigMap
metadata:
annotations:
k8s-sidecar-target-directory: "/var/lib/grafana/dashboards/private/{{ $.Values.provider.kind }}"
labels:
{{- include "labels.common" $ | nindent 6 }}
name: {{ printf "grafana-%s-%s-dashboard" $.Values.provider.kind $dashboardName | trunc 63 | trimSuffix "-" }}
namespace: {{ $.Values.global.namespace }}
data:
{{ $dashboardName }}.json: {{ $.Files.Get $path | toJson }}
{{- end }}
16 changes: 8 additions & 8 deletions helm/dashboards/values.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,18 +53,18 @@
"namespace": {
"type": "string"
},
"provider": {
"type": "object",
"properties": {
"kind": {
"type": "string"
}
}
},
"serviceType": {
"type": "string"
}
}
},
"provider": {
"type": "object",
"properties": {
"kind": {
"type": "string"
}
}
}
}
}
4 changes: 2 additions & 2 deletions helm/dashboards/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,5 @@ global:
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 b9763bd

Please sign in to comment.