feat(monitoring): init monitoring chart

This commit is contained in:
WrenIX 2023-10-26 00:02:52 +02:00
parent cc37fb0dc5
commit 5a18c7e1cf
Signed by: wrenix
GPG key ID: 7AFDB012974B1BB5
8 changed files with 256 additions and 2 deletions

16
README.md.gotmpl Normal file
View file

@ -0,0 +1,16 @@
{{ template "chart.header" . }}
{{ template "chart.deprecationWarning" . }}
{{ template "chart.badgesSection" . }}
{{ template "chart.description" . }}
{{ template "chart.homepageLine" . }}
{{ template "chart.maintainersSection" . }}
{{ template "chart.sourcesSection" . }}
{{ template "chart.requirementsSection" . }}
{{ template "chart.valuesSection" . }}

23
monitoring/.helmignore Normal file
View file

@ -0,0 +1,23 @@
# Patterns to ignore when building packages.
# This supports shell glob matching, relative path matching, and
# negation (prefixed with !). Only one pattern per line.
.DS_Store
# Common VCS dirs
.git/
.gitignore
.bzr/
.bzrignore
.hg/
.hgignore
.svn/
# Common backup files
*.swp
*.bak
*.tmp
*.orig
*~
# Various IDEs
.project
.idea/
*.tmproj
.vscode/

6
monitoring/Chart.yaml Normal file
View file

@ -0,0 +1,6 @@
apiVersion: v2
name: monitoring
description: Deploy helper for probes and scrapeconfig of prometheus-operator
type: application
version: 0.1.0

37
monitoring/README.md Normal file
View file

@ -0,0 +1,37 @@
# monitoring
![Version: 0.1.0](https://img.shields.io/badge/Version-0.1.0-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square)
Deploy helper for probes and scrapeconfig of prometheus-operator
## Values
| Key | Type | Default | Description |
|-----|------|---------|-------------|
| prober | list | `[{"name":"local","spec":{"path":"/probe","url":"prometheus-blackbox-exporter:9115"}}]` | prober for each the following probes are created (multiside probes) |
| prober[0].name | string | `"local"` | name of prober |
| prober[0].spec | object | `{"path":"/probe","url":"prometheus-blackbox-exporter:9115"}` | spec of prober (like url, path, scheme ...) |
| probes[0].groups | object | `{"framasoft":["framasoft.org","degooglisons-internet.org","framapiaf.org","framatube.org"]}` | groups with targets |
| probes[0].ipv4 | bool | `true` | setup one for ipv4 (see module and his suffix) |
| probes[0].ipv6 | bool | `true` | setup one for ipv6 (see module and his suffix) |
| probes[0].module | string | `"http_2xx"` | probe module (suffix with _ipv4 and ipv6 if enabled) |
| probes[0].name | string | `"http"` | name of probe |
| probes[1].groups | object | `{"digitalcourage":["digitalcourage.de","nuudel.digitalcourage.de","digitalcourage.social"]}` | groups with targets |
| probes[1].ipv4 | bool | `true` | setup one for ipv4 (see module and his suffix) |
| probes[1].ipv6 | bool | `false` | setup one for ipv6 (see module and his suffix) |
| probes[1].module | string | `"http_2xx"` | probe module (suffix with _ipv4 and ipv6 if enabled) |
| probes[1].name | string | `"http-ipv4"` | name of probe |
| prometheus.probe.labels | object | `{"prometheus":"default"}` | labels on Probe |
| prometheus.scrape.labels | object | `{"prometheus":"default"}` | labels on ScrapeConfig |
| scrapes[0].groups | object | `{"de":["ber.de.local:9100","fra.de.local:9100","ham.de.local:9100"],"ie":["dub.ie.local:9100","ork.ie.local:9100"]}` | groups with targets |
| scrapes[0].name | string | `"nodes"` | name of scrape |
| scrapes[1].auth.password | string | `nil` | basic auth password |
| scrapes[1].auth.token | string | `nil` | bearer token |
| scrapes[1].auth.username | string | `nil` | basic auth username |
| scrapes[1].groups | object | `{"de":["fra.de.s3.local:9000","ham.de.s3.local:9000"],"ie":["dub.ie.s3.local:9000"]}` | groups with targets |
| scrapes[1].metricsPath | string | `"/minio/v2/metrics/node"` | metric path on scrape |
| scrapes[1].name | string | `"minio"` | name of scrape |
| scrapes[1].scheme | string | `"http"` | schema on scrape |
----------------------------------------------
Autogenerated from chart metadata using [helm-docs v1.11.2](https://github.com/norwoodj/helm-docs/releases/v1.11.2)

View file

@ -0,0 +1,31 @@
{{- range $prober := $.Values.prober }}
{{- range $probe := $.Values.probes }}
{{- range $groupName, $group := $probe.groups }}
{{- $proto := "ipv4" }}
{{- range $proto := (list "ipv4" "ipv6") }}
{{- if (get $probe $proto) }}
---
apiVersion: monitoring.coreos.com/v1
kind: Probe
metadata:
name: {{ $probe.name }}-{{ $groupName }}-{{ $proto }}-{{ $prober.name }}
labels:
{{- toYaml $.Values.prometheus.probe.labels | nindent 4 }}
spec:
jobName: "blackbox-{{ $probe.name }}-{{ $proto }}"
prober:
{{- toYaml $prober.spec | nindent 4}}
module: "{{ $probe.module }}_{{ $proto }}"
targets:
staticConfig:
labels:
group: {{ $groupName }}
probe: {{ $probe.name }}
prober: {{ $prober.name }}
static:
{{- toYaml $group | nindent 8 }}
{{- end }}
{{- end }}
{{- end }}
{{- end }}
{{- end }}

View file

@ -0,0 +1,59 @@
{{- range $scrape := $.Values.scrapes }}
{{ $secretName := printf "monitoring-scrape-%s" $scrape.name }}
{{- with $scrape.auth }}
---
apiVersion: v1
kind: Secret
metadata:
name: {{ $secretName }}
data:
{{- with .token }}
token: {{ . | b64enc }}
{{- end }}
{{- with .username }}
username: {{ . | b64enc }}
{{- end }}
{{- with .password }}
password: {{ . | b64enc }}
{{- end }}
{{- end }}
---
apiVersion: monitoring.coreos.com/v1alpha1
kind: ScrapeConfig
metadata:
name: monitoring-{{ $scrape.name }}
labels:
{{- toYaml $.Values.prometheus.scrape.labels | nindent 4 }}
spec:
{{- with $scrape.scheme }}
scheme: {{ . | quote }}
{{- end }}
{{- with $scrape.metricsPath }}
metricsPath: {{ . | quote }}
{{- end }}
{{- if $scrape.auth }}
{{- if $scrape.auth.token }}
authorization:
type: "Bearer"
credentials:
name: {{ $secretName }}
key: token
{{- else }}
basicAuth:
username:
name: {{ $secretName }}
key: username
password:
name: {{ $secretName }}
key: password
{{- end }}
{{- end }}
staticConfigs:
{{- range $groupName, $group := $scrape.groups }}
- labels:
group: {{ $groupName }}
scrape: {{ $scrape.name }}
targets:
{{- toYaml $group | nindent 8 }}
{{- end }}
{{- end }}

83
monitoring/values.yaml Normal file
View file

@ -0,0 +1,83 @@
prometheus:
scrape:
# -- labels on ScrapeConfig
labels:
prometheus: "default"
probe:
# -- labels on Probe
labels:
prometheus: "default"
scrapes:
- # -- name of scrape
name: nodes
# -- groups with targets
groups:
de:
- "ber.de.local:9100"
- "fra.de.local:9100"
- "ham.de.local:9100"
ie:
- "dub.ie.local:9100"
- "ork.ie.local:9100"
- # -- name of scrape
name: minio
# -- metric path on scrape
metricsPath: /minio/v2/metrics/node
# -- schema on scrape
scheme: http
auth:
# -- basic auth username
username:
# -- basic auth password
password:
# -- bearer token
token:
# -- groups with targets
groups:
de:
- "fra.de.s3.local:9000"
- "ham.de.s3.local:9000"
ie:
- "dub.ie.s3.local:9000"
# -- prober for each the following probes are created (multiside probes)
prober:
- # -- name of prober
name: "local"
# -- spec of prober (like url, path, scheme ...)
spec:
url: "prometheus-blackbox-exporter:9115"
path: "/probe"
probes:
- # -- probe module (suffix with _ipv4 and ipv6 if enabled)
module: http_2xx
# -- name of probe
name: http
# -- setup one for ipv4 (see module and his suffix)
ipv4: true
# -- setup one for ipv6 (see module and his suffix)
ipv6: true
# -- groups with targets
groups:
framasoft:
- framasoft.org
- degooglisons-internet.org
- framapiaf.org
- framatube.org
- # -- probe module (suffix with _ipv4 and ipv6 if enabled)
module: http_2xx
# -- name of probe
name: http-ipv4
# -- setup one for ipv4 (see module and his suffix)
ipv4: true
# -- setup one for ipv6 (see module and his suffix)
ipv6: false
# -- groups with targets
groups:
digitalcourage:
- digitalcourage.de
- nuudel.digitalcourage.de
- digitalcourage.social

View file

@ -1,7 +1,5 @@
#/bin/sh #/bin/sh
helm-docs
HELM_REPO=${HELM_REPO:-oci://codeberg.org/wrenix/helm-charts} HELM_REPO=${HELM_REPO:-oci://codeberg.org/wrenix/helm-charts}
for p in * ; do for p in * ; do
@ -10,6 +8,7 @@ for p in * ; do
fi fi
echo "${p}:"; echo "${p}:";
helm-docs -t ../README.md.gotmpl
# last pkg # last pkg
lastTag=$(git tag -l "${p}-v*" | tail -1) lastTag=$(git tag -l "${p}-v*" | tail -1)