Skip to content

Commit

Permalink
apps/monitoring: add grafana mixin
Browse files Browse the repository at this point in the history
  • Loading branch information
paulfantom committed Oct 23, 2021
1 parent bdf44c2 commit 5449585
Show file tree
Hide file tree
Showing 5 changed files with 703 additions and 26 deletions.
31 changes: 16 additions & 15 deletions apps/monitoring/jsonnet/jsonnetfile.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,16 @@
{
"source": {
"git": {
"remote": "https://github.com/prometheus-operator/kube-prometheus",
"subdir": "jsonnet/kube-prometheus"
"remote": "https://github.com/grafana/grafana.git",
"subdir": "grafana-mixin"
}
},
"version": "main"
},
{
"source": {
"git": {
"remote": "https://github.com/kubernetes-monitoring/kubernetes-mixin",
"remote": "https://github.com/kubernetes-monitoring/kubernetes-mixin.git",
"subdir": ""
}
},
Expand All @@ -22,60 +22,61 @@
{
"source": {
"git": {
"remote": "https://github.com/povilasv/coredns-mixin"
"remote": "https://github.com/povilasv/coredns-mixin.git",
"subdir": ""
}
},
"version": "master"
},
{
"source": {
"git": {
"remote": "https://github.com/thaum-xyz/jsonnet-libs",
"subdir": "apps/kube-events-exporter"
"remote": "https://github.com/prometheus-operator/kube-prometheus.git",
"subdir": "jsonnet/kube-prometheus"
}
},
"version": "main"
},
{
"source": {
"git": {
"remote": "https://github.com/thaum-xyz/jsonnet-libs",
"subdir": "apps/pagespeed"
"remote": "https://github.com/thaum-xyz/jsonnet-libs.git",
"subdir": "apps/kube-events-exporter"
}
},
"version": "main"
},
{
"source": {
"git": {
"remote": "https://github.com/thaum-xyz/jsonnet-libs",
"subdir": "apps/prometheus-exporter"
"remote": "https://github.com/thaum-xyz/jsonnet-libs.git",
"subdir": "apps/pagespeed"
}
},
"version": "main"
},
{
"source": {
"git": {
"remote": "https://github.com/thaum-xyz/jsonnet-libs",
"subdir": "apps/pushgateway"
"remote": "https://github.com/thaum-xyz/jsonnet-libs.git",
"subdir": "apps/prometheus-exporter"
}
},
"version": "main"
},
{
"source": {
"git": {
"remote": "https://github.com/thaum-xyz/jsonnet-libs",
"subdir": "apps/sloth"
"remote": "https://github.com/thaum-xyz/jsonnet-libs.git",
"subdir": "apps/pushgateway"
}
},
"version": "main"
},
{
"source": {
"git": {
"remote": "https://github.com/thaum-xyz/jsonnet-libs",
"remote": "https://github.com/thaum-xyz/jsonnet-libs.git",
"subdir": "utils"
}
},
Expand Down
20 changes: 10 additions & 10 deletions apps/monitoring/jsonnet/jsonnetfile.lock.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,16 @@
"version": "ef1f71a9f65a06b5810527731101de43a1b286d7",
"sum": "cdKL5kPYfpWSpTCu4qctmh+gWQqL+4YWom6rw9qLYJU="
},
{
"source": {
"git": {
"remote": "https://github.com/grafana/grafana.git",
"subdir": "grafana-mixin"
}
},
"version": "f496c31018cdb5ecc8b3c30ea96a235a5bcf470a",
"sum": "9MEef25py18Q3NVHaW4NJF+pEL1HDSdR8VJAFD++Efw="
},
{
"source": {
"git": {
Expand Down Expand Up @@ -205,16 +215,6 @@
"version": "376e28ea96207f72b81d145ee2c108ab1ec9e4a7",
"sum": "LX92wD2SVhLG4ezLa/vNpO34kcd6/s2YCYXZBNfl7pE="
},
{
"source": {
"git": {
"remote": "https://github.com/thaum-xyz/jsonnet-libs.git",
"subdir": "apps/sloth"
}
},
"version": "376e28ea96207f72b81d145ee2c108ab1ec9e4a7",
"sum": "lSwta4y7YmiW8+WUKhjbOBrXz3JFnFI3CpQJtLd9ZrU="
},
{
"source": {
"git": {
Expand Down
22 changes: 21 additions & 1 deletion apps/monitoring/jsonnet/main.jsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,13 @@ local kp =
//

// TODO: figure out how to make this a JSON/YAML file!
values+:: (import '../config.jsonnet'),
values+:: (import '../config.jsonnet') +
// TODO: Remove this when https://github.com/prometheus-operator/kube-prometheus/pull/1458 is merged
{
grafana+: {
dashboards+: (import 'github.com/grafana/grafana/grafana-mixin/mixin.libsonnet').grafanaDashboards,
},
},

//
// Objects customization
Expand Down Expand Up @@ -338,6 +344,20 @@ local kp =
},
},

// TODO: Remove PrometheusRule object when https://github.com/prometheus-operator/kube-prometheus/pull/1458 is merged
prometheusRule: {
apiVersion: 'monitoring.coreos.com/v1',
kind: 'PrometheusRule',
metadata: $.grafana.deployment.metadata {
name: $.grafana.deployment.metadata.name + '-rules',
},
spec: {
local r = std.parseYaml(importstr 'github.com/grafana/grafana/grafana-mixin/rules/rules.yaml').groups,
local a = std.parseYaml(importstr 'github.com/grafana/grafana/grafana-mixin/alerts/alerts.yaml').groups,
groups: a + r,
},
},

pvc: {
kind: 'PersistentVolumeClaim',
apiVersion: 'v1',
Expand Down
Loading

0 comments on commit 5449585

Please sign in to comment.