Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support configure alertmanager #148

Merged
merged 6 commits into from
Sep 23, 2020
Merged
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 38 additions & 0 deletions jsonnet/kube-thanos/kube-thanos-rule.libsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -183,4 +183,42 @@ local k = import 'ksonnet/ksonnet.beta.4/k.libsonnet';
},
},
},

withAlertmanagers:: {
local tr = self,
config+:: {
ruleConfigMapName: error 'must provide rulesConfigMapName',
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we need to be consistent here; it should either be rulesConfigMapName or ruleConfigMapName without the s

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

forgot to update the message.

ruleFileKey: error 'must provide ruleFileKey',
alertmanagersURL: error 'must provide alertmanagersURL',
},

statefulSet+: {
spec+: {
template+: {
spec+: {
containers: [
if c.name == 'thanos-rule' then c {
args+: [
'--alertmanagers.url=' + alertmanagerURL,
for alertmanagerURL in tr.config.alertmanagersURL
] + [
'--rule-file=/etc/thanos/rules/' + tr.config.ruleFileKey,
],
volumeMounts+: [
{ name: 'rules-config', mountPath: '/etc/thanos/rules' },
],
} else c
for c in super.containers
],

local volume = k.apps.v1.statefulSet.mixin.spec.template.spec.volumesType,
volumes+: [
volume.withName('rules-config') +
volume.mixin.configMap.withName(tr.config.ruleConfigMapName),
],
},
},
},
},
},
}