Skip to content

Commit

Permalink
add dashboards as app
Browse files Browse the repository at this point in the history
  • Loading branch information
klinch0 committed Jan 2, 2025
1 parent fde4bcf commit 1a22049
Show file tree
Hide file tree
Showing 15 changed files with 407 additions and 23 deletions.
3 changes: 3 additions & 0 deletions packages/apps/grafana-dashboards/.helmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.helmignore
/logos
/Makefile
8 changes: 8 additions & 0 deletions packages/apps/grafana-dashboards/Chart.yaml
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"
4 changes: 4 additions & 0 deletions packages/apps/grafana-dashboards/Makefile
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
11 changes: 11 additions & 0 deletions packages/apps/grafana-dashboards/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. | `{}` |
269 changes: 269 additions & 0 deletions packages/apps/grafana-dashboards/logos/grafana-dashboards.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
41 changes: 41 additions & 0 deletions packages/apps/grafana-dashboards/templates/grafana-dashboards.yaml
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 }}
{{- end }}
23 changes: 23 additions & 0 deletions packages/apps/grafana-dashboards/values.schema.json
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": {}
},
"jsonDashboards": {
"type": "array",
"description": "List of dashboards with inline JSON.",
"default": [],
"items": {}
},
"instanceSelector": {
"type": "object",
"description": "Selector to match Grafana instances.",
"default": {}
}
}
}
38 changes: 38 additions & 0 deletions packages/apps/grafana-dashboards/values.yaml
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"
2 changes: 1 addition & 1 deletion packages/apps/tenant/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ description: Separated tenant namespace
icon: /logos/tenant.svg

type: application
version: 1.6.5
version: 1.6.6
18 changes: 1 addition & 17 deletions packages/apps/tenant/templates/tenant.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -241,23 +241,7 @@ rules:
- list
- apiGroups: ["apps.cozystack.io"]
resources:
- buckets
- clickhouses
- ferretdb
- foos
- httpcaches
- kafkas
- kuberneteses
- mysqls
- natses
- postgreses
- rabbitmqs
- redises
- seaweedfses
- tcpbalancers
- virtualmachines
- vmdisks
- vminstances
- "*"
verbs:
- get
- list
Expand Down
4 changes: 3 additions & 1 deletion packages/apps/versions_map
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ ferretdb 0.2.0 adaf603
ferretdb 0.3.0 aa2f553
ferretdb 0.4.0 def2eb0f
ferretdb 0.4.1 HEAD
grafana-dashboards 0.1.0 HEAD
http-cache 0.1.0 a956713
http-cache 0.2.0 5ca8823
http-cache 0.3.0 fab5940
Expand Down Expand Up @@ -95,7 +96,8 @@ tenant 1.6.1 edbbb9be
tenant 1.6.2 ccedc5fe
tenant 1.6.3 2057bb96
tenant 1.6.4 3c9e50a4
tenant 1.6.5 HEAD
tenant 1.6.5 f1e11451
tenant 1.6.6 HEAD
virtual-machine 0.1.4 f2015d6
virtual-machine 0.1.5 7cd7de7
virtual-machine 0.2.0 5ca8823
Expand Down
2 changes: 1 addition & 1 deletion packages/core/installer/values.yaml
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
2 changes: 1 addition & 1 deletion packages/extra/monitoring/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ name: monitoring
description: Monitoring and observability stack
icon: /logos/monitoring.svg
type: application
version: 1.5.3
version: 1.5.4
2 changes: 1 addition & 1 deletion packages/extra/monitoring/templates/grafana/grafana.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ kind: Grafana
metadata:
name: grafana
labels:
dashboards: grafana
dashboards: "{{ $myNS }}"
spec:
config:
log:
Expand Down
3 changes: 2 additions & 1 deletion packages/extra/versions_map
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ monitoring 1.4.0 adaf603b
monitoring 1.5.0 4b90bf5a
monitoring 1.5.1 57e90b70
monitoring 1.5.2 898374b5
monitoring 1.5.3 HEAD
monitoring 1.5.3 c1ca19dc
monitoring 1.5.4 HEAD
seaweedfs 0.1.0 5ca8823
seaweedfs 0.2.0 9e33dc0
seaweedfs 0.2.1 HEAD

0 comments on commit 1a22049

Please sign in to comment.