Remove thanosSelector and expose mixin._config.thanos config variable for thanos sidecar

This commit removes existing `thanosSelector` and exposes a single config variable `mixin._config.thanos` to customize thanos sidecar mixins. It follows same structure as d2d74dac98/mixin/config.libsonnet

Signed-off-by: Arunprasad Rajkumar <arajkuma@redhat.com>
This commit is contained in:
Arunprasad Rajkumar
2021-12-09 17:10:05 +05:30
parent 9ca30579f6
commit 1fb864ec21

View File

@@ -34,7 +34,15 @@ local defaults = {
_config: {
prometheusSelector: 'job="prometheus-' + defaults.name + '",namespace="' + defaults.namespace + '"',
prometheusName: '{{$labels.namespace}}/{{$labels.pod}}',
thanosSelector: 'job="thanos-sidecar"',
thanos: {
targetGroups: {
namespace: defaults.namespace,
},
sidecar: {
selector: 'job="thanos-sidecar"',
thanosPrometheusCommonDimensions: 'namespace, pod',
},
},
runbookURLPattern: 'https://runbooks.prometheus-operator.dev/runbooks/prometheus/%s',
},
},
@@ -65,12 +73,8 @@ function(params) {
(import 'github.com/thanos-io/thanos/mixin/alerts/sidecar.libsonnet') +
(import 'github.com/kubernetes-monitoring/kubernetes-mixin/lib/add-runbook-links.libsonnet') + {
_config+:: p._config.mixin._config,
targetGroups: {},
sidecar: {
selector: p._config.mixin._config.thanosSelector,
thanosPrometheusCommonDimensions: 'namespace, pod',
dimensions: std.join(', ', ['job', 'instance']),
},
targetGroups+: p._config.mixin._config.thanos.targetGroups,
sidecar+: p._config.mixin._config.thanos.sidecar,
},
prometheusRule: {