Skip to content

Commit

Permalink
feat: create GrafanaDashboard CR for GrafanaOperator (#322)
Browse files Browse the repository at this point in the history
Signed-off-by: Johannes Kleinlercher <johannes.kleinlercher@suxess-it.com>
Co-authored-by: Alex Jones <alexsimonjones@gmail.com>
Co-authored-by: JuHyung Son <sonju0427@gmail.com>
  • Loading branch information
3 people committed Mar 22, 2024
1 parent eed77ae commit e4391ab
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 0 deletions.
21 changes: 21 additions & 0 deletions chart/operator/templates/grafana-k8sgpt-dashboard.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,25 @@ metadata:
data:
k8sgpt-overview.json: |
{{ .Files.Get "dashboards/k8sgpt-overview.json" | indent 4}}
---
{{ if .Values.grafanaDashboard.grafanaOperator.enabled -}}
apiVersion: grafana.integreatly.org/v1beta1
kind: GrafanaDashboard
metadata:
labels:
app.kubernetes.io/component: grafana-dashboard
app.kubernetes.io/created-by: k8sgpt-operator
app.kubernetes.io/part-of: k8sgpt-operator
{{- include "chart.labels" . | nindent 4 }}
name: k8sgpt-overview
namespace: {{ .Values.grafanaDashboard.namespace | default (include "k8sgpt-operator.namespace" .) }}
spec:
folder: {{ .Values.grafanaDashboard.folder.name }}
instanceSelector:
matchLabels:
{{- toYaml $.Values.grafanaDashboard.grafanaOperator.matchLabels | nindent 6 }}
configMapRef:
name: k8sgpt-overview
key: k8sgpt-overview.json
{{ end -}}
{{ end -}}
6 changes: 6 additions & 0 deletions chart/operator/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,12 @@ grafanaDashboard:
label:
key: grafana_dashboard
value: "1"
# create GrafanaDashboard custom resource referencing to the configMap.
# according to https://grafana-operator.github.io/grafana-operator/docs/examples/dashboard_from_configmap/readme/
grafanaOperator:
enabled: false
matchLabels:
dashboards: "grafana"
controllerManager:
kubeRbacProxy:
containerSecurityContext:
Expand Down

0 comments on commit e4391ab

Please sign in to comment.