Skip to content

Commit

Permalink
separate alertmanager with rules
Browse files Browse the repository at this point in the history
Signed-off-by: clyang82 <chuyang@redhat.com>
  • Loading branch information
clyang82 committed Sep 23, 2020
1 parent f08555a commit 84a4bfb
Showing 1 changed file with 26 additions and 4 deletions.
30 changes: 26 additions & 4 deletions jsonnet/kube-thanos/kube-thanos-rule.libsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -187,8 +187,6 @@ local k = import 'ksonnet/ksonnet.beta.4/k.libsonnet';
withAlertmanagers:: {
local tr = self,
config+:: {
ruleConfigMapName: error 'must provide ruleConfigMapName',
ruleFileKey: error 'must provide ruleFileKey',
alertmanagersURL: error 'must provide alertmanagersURL',
},

Expand All @@ -201,8 +199,32 @@ local k = import 'ksonnet/ksonnet.beta.4/k.libsonnet';
args+: [
'--alertmanagers.url=' + alertmanagerURL,
for alertmanagerURL in tr.config.alertmanagersURL
] + [
'--rule-file=/etc/thanos/rules/' + tr.config.ruleFileKey,
],
} else c
for c in super.containers
],
},
},
},
},
},

withRules:: {
local tr = self,
config+:: {
ruleConfigMapName: error 'must provide ruleConfigMapName',
ruleFilesKey: error 'must provide ruleFilesKey',
},

statefulSet+: {
spec+: {
template+: {
spec+: {
containers: [
if c.name == 'thanos-rule' then c {
args+: [
'--rule-file=/etc/thanos/rules/' + ruleFileKey,
for ruleFileKey in tr.config.ruleFilesKey
],
volumeMounts+: [
{ name: 'rules-config', mountPath: '/etc/thanos/rules' },
Expand Down

0 comments on commit 84a4bfb

Please sign in to comment.