Skip to content

Commit ba57674

Browse files
committed
[loki] Generate Dashboards from loki-mixin
Signed-off-by: Jan-Otto Kröpke <mail@jkroepke.de>
1 parent ffb9f4a commit ba57674

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+2097
-17351
lines changed

charts/loki/.gitignore

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,12 @@
1-
charts/
1+
# Python development for hack
2+
venv
3+
pyvenv.cfg
4+
!**
5+
charts/*
6+
!charts/crds/
7+
!charts/crds/**
8+
Chart.lock
9+
hack/*.git
10+
hack/tmp/
11+
hack/venv/
12+
hack/pyvenv.cfg

charts/loki/.helmignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,3 +30,4 @@ test/
3030
scenarios/
3131
docs/
3232
*-values.yaml
33+
hack/

charts/loki/Chart.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ description: Helm chart for Grafana Loki supporting monolithic, simple scalable,
44
type: application
55
# renovate: docker=docker.io/grafana/loki
66
appVersion: 3.7.1
7-
version: 9.3.3
7+
version: 9.5.0
88
kubeVersion: ">=1.25.0-0"
99
home: https://grafana-community.github.io/helm-charts
1010
sources:

charts/loki/ci/lint.sh

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
#!/usr/bin/env bash
2+
3+
set -euo pipefail
4+
5+
{
6+
SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)
7+
8+
cd "${SCRIPT_DIR}/../hack/"
9+
10+
export PIP_DISABLE_PIP_VERSION_CHECK=1
11+
12+
python3 -m venv venv
13+
# shellcheck disable=SC1091
14+
source venv/bin/activate
15+
16+
pip3 install -r requirements.txt
17+
18+
go install -a github.com/jsonnet-bundler/jsonnet-bundler/cmd/jb@latest
19+
PATH="$(go env GOPATH)/bin:$PATH"
20+
export PATH
21+
22+
./sync_grafana_dashboards.py
23+
if ! git diff "$GITHUB_SHA" --color=always --exit-code; then
24+
echo "Changes inside dashboards are not supported!"
25+
echo "Please go into the ./hack/ directory and run ./sync_grafana_dashboards.py"
26+
exit 1
27+
fi
28+
29+
rm -rf ./venv ./*.git
30+
} 2>&1

charts/loki/ci/non-default-values.yaml

Lines changed: 47 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,13 @@ nameOverride: '{{ $.Release.Name }}'
33
test:
44
enabled: true
55
loki:
6+
auth_enabled: true
67
commonConfig:
78
replication_factor: 1
89
useTestSchema: true
910
tenants:
11+
- name: "self-monitoring"
12+
password: "self-monitoring"
1013
- name: "test-user-1"
1114
password: "test-password-1"
1215
- name: "test-user-2"
@@ -16,9 +19,42 @@ loki:
1619
- name: ndots
1720
value: "3"
1821
ingester:
19-
replicas: 0
22+
replicas: 1
2023
zoneAwareReplication:
2124
enabled: true
25+
zoneA:
26+
extraAffinity:
27+
podAntiAffinity:
28+
requiredDuringSchedulingIgnoredDuringExecution:
29+
- labelSelector:
30+
matchExpressions:
31+
- key: name
32+
operator: In
33+
values:
34+
- '{{ include "loki.prefixIngesterName" . }}ingester-zone-a'
35+
topologyKey: kubernetes.io/hostname
36+
zoneB:
37+
extraAffinity:
38+
podAntiAffinity:
39+
requiredDuringSchedulingIgnoredDuringExecution:
40+
- labelSelector:
41+
matchExpressions:
42+
- key: name
43+
operator: In
44+
values:
45+
- '{{ include "loki.prefixIngesterName" . }}ingester-zone-b'
46+
topologyKey: kubernetes.io/hostname
47+
zoneC:
48+
extraAffinity:
49+
podAntiAffinity:
50+
requiredDuringSchedulingIgnoredDuringExecution:
51+
- labelSelector:
52+
matchExpressions:
53+
- key: name
54+
operator: In
55+
values:
56+
- '{{ include "loki.prefixIngesterName" . }}ingester-zone-c'
57+
topologyKey: kubernetes.io/hostname
2258
dnsConfig:
2359
options:
2460
- name: ndots
@@ -51,6 +87,8 @@ queryScheduler:
5187
lokiCanary:
5288
enabled: true
5389
kind: Deployment
90+
tenant:
91+
password: "self-monitoring"
5492
chunksCache:
5593
suffix: "l1"
5694
enabled: true
@@ -80,9 +118,17 @@ gateway:
80118
metrics:
81119
enabled: false
82120
monitoring:
121+
serviceMonitor:
122+
enabled: true
123+
labels:
124+
release: kube-prometheus-stack
125+
dashboards:
126+
enabled: true
83127
rules:
84128
enabled: true
85129
alerting: true
130+
labels:
131+
release: kube-prometheus-stack
86132
additionalGroups:
87133
- name: "additional-rules"
88134
rules:

charts/loki/hack/README.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# loki charts hacks
2+
3+
## [update_mixins.sh](update_mixins.sh)
4+
5+
This script is a useful wrapper to run `sync_grafana_dashboards.py`.
6+
7+
It clones all dependency dashboards into a tmp folder.
8+
9+
And it lets you know if you are missing commandline-tools necessary for the
10+
update to complete.
11+
12+
Therefore, if you want to create a PR that updates the mixins, please
13+
run `./hack/update_mixins.sh` from the charts directory
14+
(`./charts/loki`).
15+
16+
## [sync_grafana_dashboards.py](sync_grafana_dashboards.py)
17+
18+
This script generates grafana dashboards from JSON files, splitting them to separate files based on group name.
19+
20+
List of imported dashboards:
21+
22+
- [grafana/loki](https://github.com/grafana/loki/tree/main/production/loki-mixin) dashboards.
23+
- In order to modify these dashboards:
24+
- prepare and merge PR into [loki-mixin](https://github.com/grafana/loki/tree/main/production/loki-mixin) main and/or release branch.
25+
- run sync_grafana_dashboards.py inside your fork of this repository
26+
- send PR with changes to this repository
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
#!/usr/bin/env bash
2+
3+
set -euo pipefail
4+
5+
SCRIPT_DIR=$(cd -- "$(dirname -- "${0}")" &>/dev/null && pwd)
6+
7+
if ! which jb &>/dev/null; then
8+
if ! which go &>/dev/null; then
9+
echo "'jb' command not found"
10+
echo "Install jsonnet-bundler from https://github.com/jsonnet-bundler/jsonnet-bundler"
11+
exit 1
12+
fi
13+
14+
echo "'jb' command not found. Try to install it from github.com/jsonnet-bundler/jsonnet-bundler"
15+
16+
go install -a github.com/jsonnet-bundler/jsonnet-bundler/cmd/jb@latest
17+
PATH="$(go env GOPATH)/bin:$PATH"
18+
export PATH
19+
20+
if ! which jb &>/dev/null; then
21+
echo "'jb' command not found"
22+
echo "Install jsonnet-bundler from https://github.com/jsonnet-bundler/jsonnet-bundler"
23+
exit 1
24+
fi
25+
fi
26+
27+
export PIP_DISABLE_PIP_VERSION_CHECK=1
28+
29+
python3 -m venv "${SCRIPT_DIR}/tmp/venv"
30+
# shellcheck disable=SC1091
31+
source "${SCRIPT_DIR}/tmp/venv/bin/activate"
32+
33+
pip3 install -r "${SCRIPT_DIR}/requirements.txt"
34+
35+
"${SCRIPT_DIR}/sync_grafana_dashboards.py"

charts/loki/hack/requirements.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
PyYAML==6.0.3
2+
requests==2.32.5
3+
jsonnet==0.21.0

0 commit comments

Comments
 (0)