-
Notifications
You must be signed in to change notification settings - Fork 62
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 dashboards as app #554
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
.helmignore | ||
/logos | ||
/Makefile |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
apiVersion: v2 | ||
name: grafana-dashboards | ||
description: Grafana dashboards | ||
icon: /logos/grafana-dashboards.svg | ||
|
||
type: application | ||
version: 0.1.0 | ||
appVersion: "0.1.0" |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
include ../../../scripts/package.mk | ||
|
||
generate: | ||
readme-generator -v values.yaml -s values.schema.json -r README.md |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# Grafana dashboards | ||
|
||
## Parameters | ||
|
||
### Dashboard parameters | ||
|
||
| Name | Description | Value | | ||
| ------------------ | ------------------------------------ | ----- | | ||
| `urlDashboards` | List of dashboards with URLs. | `[]` | | ||
| `jsonDashboards` | List of dashboards with inline JSON. | `[]` | | ||
| `instanceSelector` | Selector to match Grafana instances. | `{}` | |
Original file line number | Diff line number | Diff line change | ||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
@@ -0,0 +1,41 @@ | ||||||||||||||||||||
|
||||||||||||||||||||
{{- $myNS := lookup "v1" "Namespace" "" .Release.Namespace }} | ||||||||||||||||||||
|
||||||||||||||||||||
|
||||||||||||||||||||
{{- range .Values.urlDashboards }} | ||||||||||||||||||||
--- | ||||||||||||||||||||
apiVersion: grafana.integreatly.org/v1beta1 | ||||||||||||||||||||
kind: GrafanaDashboard | ||||||||||||||||||||
metadata: | ||||||||||||||||||||
name: {{ .name }} | ||||||||||||||||||||
spec: | ||||||||||||||||||||
{{- if .Values.instanceSelector | not }} | ||||||||||||||||||||
instanceSelector: | ||||||||||||||||||||
matchLabels: | ||||||||||||||||||||
dashboards: {{ $myNS }} | ||||||||||||||||||||
{{- else }} | ||||||||||||||||||||
instanceSelector: | ||||||||||||||||||||
{{ $instanceSelector | indent 4 }} | ||||||||||||||||||||
{{- end }} | ||||||||||||||||||||
url: {{ .link }} | ||||||||||||||||||||
{{- end }} | ||||||||||||||||||||
|
||||||||||||||||||||
{{- range .Values.jsonDashboards }} | ||||||||||||||||||||
--- | ||||||||||||||||||||
apiVersion: grafana.integreatly.org/v1beta1 | ||||||||||||||||||||
kind: GrafanaDashboard | ||||||||||||||||||||
metadata: | ||||||||||||||||||||
name: {{ .name }} | ||||||||||||||||||||
spec: | ||||||||||||||||||||
{{- if .Values.instanceSelector | not }} | ||||||||||||||||||||
instanceSelector: | ||||||||||||||||||||
matchLabels: | ||||||||||||||||||||
dashboards: {{ $myNS }} | ||||||||||||||||||||
{{- else }} | ||||||||||||||||||||
instanceSelector: | ||||||||||||||||||||
{{ $instanceSelector | indent 4 }} | ||||||||||||||||||||
{{- end }} | ||||||||||||||||||||
resyncPeriod: "30s" | ||||||||||||||||||||
json: | | ||||||||||||||||||||
{{ .json | indent 4 }} | ||||||||||||||||||||
Comment on lines
+38
to
+40
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion Validate required fields before rendering Add validation for required fields before rendering the template. + {{- if not .json }}
+ {{- fail "Dashboard json is required" }}
+ {{- end }}
resyncPeriod: "30s"
json: |
{{ .json | indent 4 }} 📝 Committable suggestion
Suggested change
|
||||||||||||||||||||
{{- end }} |
Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
@@ -0,0 +1,23 @@ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
{ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
"title": "Chart Values", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
"type": "object", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
"properties": { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
"urlDashboards": { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
"type": "array", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
"description": "List of dashboards with URLs.", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
"default": [], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
"items": {} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Comment on lines
+5
to
+10
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion Enhance schema validation for urlDashboards The "urlDashboards": {
"type": "array",
"description": "List of dashboards with URLs.",
"default": [],
- "items": {}
+ "items": {
+ "type": "object",
+ "required": ["name", "link"],
+ "properties": {
+ "name": {
+ "type": "string",
+ "description": "The name of the dashboard"
+ },
+ "link": {
+ "type": "string",
+ "format": "uri",
+ "description": "The URL of the dashboard JSON"
+ }
+ },
+ "additionalProperties": false
+ }
} 📝 Committable suggestion
Suggested change
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
"jsonDashboards": { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
"type": "array", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
"description": "List of dashboards with inline JSON.", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
"default": [], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
"items": {} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Comment on lines
+11
to
+16
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion Enhance schema validation for jsonDashboards Similar to urlDashboards, the "jsonDashboards": {
"type": "array",
"description": "List of dashboards with inline JSON.",
"default": [],
- "items": {}
+ "items": {
+ "type": "object",
+ "required": ["name", "json"],
+ "properties": {
+ "name": {
+ "type": "string",
+ "description": "The name of the dashboard"
+ },
+ "json": {
+ "type": "object",
+ "description": "The JSON content of the dashboard"
+ }
+ },
+ "additionalProperties": false
+ }
} 📝 Committable suggestion
Suggested change
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||
"instanceSelector": { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
"type": "object", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
"description": "Selector to match Grafana instances.", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
"default": {} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
## @section Dashboard parameters | ||
|
||
## @param urlDashboards List of dashboards with URLs. | ||
## Each entry must include: | ||
## - name: The name of the dashboard | ||
## - link: The URL of the dashboard JSON | ||
urlDashboards: [] # @param urlDashboards List of dashboards to load from URLs | ||
|
||
## Example: | ||
## urlDashboards: | ||
## - name: "grafanadashboard-from-url" | ||
## link: "https://raw.githubusercontent.com/grafana-operator/grafana-operator/master/examples/dashboard_from_url/dashboard.json" | ||
|
||
## @param jsonDashboards List of dashboards with inline JSON. | ||
## Each entry must include: | ||
## - name: The name of the dashboard | ||
## - json: The JSON content of the dashboard | ||
jsonDashboards: [] # @param jsonDashboards List of dashboards to load from inline JSON | ||
|
||
## Example: | ||
## jsonDashboards: | ||
## - name: "grafanadashboard-sample" | ||
## json: | | ||
## { | ||
## "panels": [ | ||
## { "type": "graph", "title": "Sample Panel" } | ||
## ] | ||
## } | ||
|
||
|
||
## @param instanceSelector Selector to match Grafana instances. | ||
## Leave empty to skip instance selection. | ||
instanceSelector: {} # @param instanceSelector Selector for matching Grafana instances | ||
|
||
## Example: | ||
## instanceSelector: | ||
## matchLabels: | ||
## dashboards: "grafana" |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,4 +4,4 @@ description: Separated tenant namespace | |
icon: /logos/tenant.svg | ||
|
||
type: application | ||
version: 1.6.5 | ||
version: 1.6.6 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
cozystack: | ||
image: ghcr.io/aenix-io/cozystack/cozystack:v0.21.1@sha256:05a1b10700b387594887785e49e496da13d83abb9dc6415195b70ed9898e9d39 | ||
image: kklinch0/cozystack:0.20.888@sha256:ecf3930271c5ac824dc6ceb6174f1368ee824e22652026e579f5a60fd910f4ac |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fix template variable references and indentation
There are several issues in the instanceSelector conditional block:
.Values
is incorrectly referenced (should beValues
)📝 Committable suggestion