Skip to content

Commit 9597436

Browse files
committed
Group two config groups together
1 parent 5c2ddd6 commit 9597436

File tree

1 file changed

+20
-15
lines changed

1 file changed

+20
-15
lines changed

prometheus-ksonnet/lib/prometheus-ha-mixin.libsonnet

Lines changed: 20 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -4,38 +4,43 @@ local statefulset = k.apps.v1.statefulSet;
44
local configMap = k.core.v1.configMap;
55

66
{
7-
prometheus_config_0:: self.prometheus_config,
8-
prometheus_config_1:: self.prometheus_config,
7+
local root = self,
98

10-
prometheusAlerts_0:: self.prometheusAlerts,
11-
prometheusAlerts_1:: self.prometheusAlerts,
9+
_config+:: {
10+
prometheus_config_file: '/etc/$(POD_NAME)/prometheus.yml',
11+
},
1212

13-
prometheusRules_0:: self.prometheusRules,
14-
prometheusRules_1:: self.prometheusRules,
13+
prometheus_zero+:: {
14+
config+:: root.prometheus_config,
15+
alerts+:: root.prometheusAlerts,
16+
rules+:: root.prometheusRules,
17+
},
1518

16-
local prom = self,
19+
prometheus_one+:: {
20+
config+:: root.prometheus_config,
21+
alerts+:: root.prometheusAlerts,
22+
rules+:: root.prometheusRules,
23+
},
1724

1825
prometheus_config_map:: {},
1926

2027
prometheus_config_maps: [
2128
configMap.new('%s-config-0' % self.name) +
2229
configMap.withData({
23-
'prometheus.yml': k.util.manifestYaml(prom.prometheus_config_0),
24-
'alerts.rules': k.util.manifestYaml(prom.prometheusAlerts_0),
25-
'recording.rules': k.util.manifestYaml(prom.prometheusRules_0),
30+
'prometheus.yml': k.util.manifestYaml(root.prometheus_zero.config),
31+
'alerts.rules': k.util.manifestYaml(root.prometheus_zero.alerts),
32+
'recording.rules': k.util.manifestYaml(root.prometheus_zero.rules),
2633
}),
2734
configMap.new('%s-config-1' % self.name) +
2835
configMap.withData({
29-
'prometheus.yml': k.util.manifestYaml(prom.prometheus_config_1),
30-
'alerts.rules': k.util.manifestYaml(prom.prometheusAlerts_1),
31-
'recording.rules': k.util.manifestYaml(prom.prometheusRules_1),
36+
'prometheus.yml': k.util.manifestYaml(root.prometheus_one.config),
37+
'alerts.rules': k.util.manifestYaml(root.prometheus_one.alerts),
38+
'recording.rules': k.util.manifestYaml(root.prometheus_one.rules),
3239
}),
3340
],
3441

3542
prometheus_config_mount:: {},
3643

37-
prometheus_config_file:: '/etc/$(POD_NAME)/prometheus.yml',
38-
3944
prometheus_container+:: container.withEnv([
4045
container.envType.fromFieldPath('POD_NAME', 'metadata.name'),
4146
]),

0 commit comments

Comments
 (0)