Add dashboards and datasources, update flow config

Signed-off-by: Michel Hollands <michel.hollands@grafana.com>
This commit is contained in:
Michel Hollands
2023-06-21 11:22:42 +01:00
parent 0f66cad545
commit 1db4265627
17 changed files with 14260 additions and 6 deletions

View File

@@ -0,0 +1,17 @@
---
apiVersion: v1
kind: ConfigMap
metadata:
name: loki-dashboards-1
namespace: {{ $.Release.Namespace }}
data:
"loki-chunks.json": |
{{ $.Files.Get "src/dashboards/loki-chunks.json" | fromJson | toJson }}
"loki-deletion.json": |
{{ $.Files.Get "src/dashboards/loki-deletion.json" | fromJson | toJson }}
"loki-logs.json": |
{{ $.Files.Get "src/dashboards/loki-logs.json" | fromJson | toJson }}
"loki-mixin-recording-rules.json": |
{{ $.Files.Get "src/dashboards/loki-mixin-recording-rules.json" | fromJson | toJson }}
"loki-operational.json": |
{{ $.Files.Get "src/dashboards/loki-operational.json" | fromJson | toJson }}

View File

@@ -0,0 +1,17 @@
---
apiVersion: v1
kind: ConfigMap
metadata:
name: loki-dashboards-2
namespace: {{ $.Release.Namespace }}
data:
"loki-reads-resources.json": |
{{ $.Files.Get "src/dashboards/loki-reads-resources.json" | fromJson | toJson }}
"loki-reads.json": |
{{ $.Files.Get "src/dashboards/loki-reads.json" | fromJson | toJson }}
"loki-retention.json": |
{{ $.Files.Get "src/dashboards/loki-retention.json" | fromJson | toJson }}
"loki-writes-resources.json": |
{{ $.Files.Get "src/dashboards/loki-writes-resources.json" | fromJson | toJson }}
"loki-writes.json": |
{{ $.Files.Get "src/dashboards/loki-writes.json" | fromJson | toJson }}

View File

@@ -0,0 +1,27 @@
---
apiVersion: v1
kind: ConfigMap
metadata:
name: loki-dashboards-provisioning
namespace: {{ $.Release.Namespace }}
data:
dashboards.yaml: |
---
apiVersion: 1
providers:
- disableDeletion: true
editable: false
folder: Loki
name: loki-1
options:
path: /var/lib/grafana/dashboards/loki-1
orgId: 1
type: file
- disableDeletion: true
editable: false
folder: Loki
name: loki-2
options:
path: /var/lib/grafana/dashboards/loki-2
orgId: 1
type: file

View File

@@ -0,0 +1,59 @@
---
apiVersion: v1
kind: ConfigMap
metadata:
name: loki-datasources-provisioning
namespace: {{ $.Release.Namespace }}
data:
datasources.yaml: |
# Configuration file version
apiVersion: 1
# List of data sources to delete from the database.
deleteDatasources:
- name: Loki
orgId: 1
# List of data sources to insert/update depending on what's
# available in the database.
datasources:
# <string, required> Sets the name you use to refer to
# the data source in panels and queries.
- name: Loki
# <string, required> Sets the data source type.
type: loki
# <int> Sets the organization id. Defaults to orgId 1.
orgId: 1
# <string> Sets a custom UID to reference this
# data source in other parts of the configuration.
# If not specified, Grafana generates one.
uid: loki_ds
# <string> Sets the data source's URL, including the
# port.
url: http://loki-gateway.{{- $.Release.Namespace -}}.svc.cluster.local
# <bool> Toggles whether the data source is pre-selected
# for new panels. You can set only one default
# data source per organization.
isDefault:
# <bool> Allows users to edit data sources from the
# Grafana UI.
editable: true
- name: Mimir
# <string, required> Sets the data source type.
type: prometheus
# <int> Sets the organization id. Defaults to orgId 1.
orgId: 1
# <string> Sets a custom UID to reference this
# data source in other parts of the configuration.
# If not specified, Grafana generates one.
uid: mimir_ds
# <string> Sets the data source's URL, including the
# port.
url: http://{{- $.Release.Name -}}-mimir-nginx.{{- $.Release.Namespace -}}.svc:80/prometheus
# <bool> Toggles whether the data source is pre-selected
# for new panels. You can set only one default
# data source per organization.
isDefault:
# <bool> Allows users to edit data sources from the
# Grafana UI.
editable: true

View File

@@ -0,0 +1,103 @@
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: grafana-pvc
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 1Gi
---
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
app: grafana
name: grafana
spec:
selector:
matchLabels:
app: grafana
template:
metadata:
labels:
app: grafana
spec:
securityContext:
fsGroup: 472
supplementalGroups:
- 0
containers:
- name: grafana
image: grafana/grafana:10.0.0
imagePullPolicy: IfNotPresent
ports:
- containerPort: 3000
name: http-grafana
protocol: TCP
readinessProbe:
failureThreshold: 3
httpGet:
path: /robots.txt
port: 3000
scheme: HTTP
initialDelaySeconds: 10
periodSeconds: 30
successThreshold: 1
timeoutSeconds: 2
livenessProbe:
failureThreshold: 3
initialDelaySeconds: 30
periodSeconds: 10
successThreshold: 1
tcpSocket:
port: 3000
timeoutSeconds: 1
resources:
requests:
cpu: 250m
memory: 750Mi
volumeMounts:
- mountPath: /var/lib/grafana
name: grafana-pv
- mountPath: /var/lib/grafana/dashboards/loki-1
name: loki-dashboards-1
- mountPath: /var/lib/grafana/dashboards/loki-2
name: loki-dashboards-2
- mountPath: /etc/grafana/provisioning/dashboards
name: loki-dashboards-provisioning
- mountPath: /etc/grafana/provisioning/datasources
name: loki-datasources-provisioning
volumes:
- name: grafana-pv
persistentVolumeClaim:
claimName: grafana-pvc
- name: loki-dashboards-provisioning
configMap:
name: loki-dashboards-provisioning
- name: loki-datasources-provisioning
configMap:
name: loki-datasources-provisioning
- name: loki-dashboards-1
configMap:
name: loki-dashboards-1
- name: loki-dashboards-2
configMap:
name: loki-dashboards-2
---
apiVersion: v1
kind: Service
metadata:
name: grafana
spec:
ports:
- port: 3000
protocol: TCP
targetPort: http-grafana
selector:
app: grafana
sessionAffinity: None
type: ClusterIP # Make this configurable