|
1 |
| -local container = $.core.v1.container; |
2 |
| -local statefulset = $.apps.v1.statefulSet; |
| 1 | +local k = import 'ksonnet-util/kausal.libsonnet'; |
| 2 | +local container = k.core.v1.container; |
| 3 | +local statefulset = k.apps.v1.statefulSet; |
| 4 | +local configMap = k.core.v1.configMap; |
3 | 5 |
|
4 | 6 | {
|
5 |
| - prometheus_config_0: $.prometheus_config, |
6 |
| - prometheus_config_1: $.prometheus_config, |
7 |
| - |
8 |
| - prometheusAlerts_0: $.prometheusAlerts, |
9 |
| - prometheusAlerts_1: $.prometheusAlerts, |
10 |
| - |
11 |
| - prometheusRules_0: $.prometheusRules, |
12 |
| - prometheusRules_1: $.prometheusRules, |
13 |
| - |
14 |
| - prometheus+:: { |
15 |
| - local configMap = $.core.v1.configMap, |
16 |
| - |
17 |
| - prometheus_config_map:: {}, |
18 |
| - |
19 |
| - prometheus_config_maps: [{ |
20 |
| - configMap.new('%s-config-0' % self.name) + |
21 |
| - configMap.withData({ |
22 |
| - 'prometheus.yml': $.util.manifestYaml($.prometheus_config_0), |
23 |
| - 'alerts.rules': $.util.manifestYaml($.prometheusAlerts_0), |
24 |
| - 'recording.rules': $.util.manifestYaml($.prometheusRules_0), |
25 |
| - }), |
26 |
| - configMap.new('%s-config-1' % self.name) + |
27 |
| - configMap.withData({ |
28 |
| - 'prometheus.yml': $.util.manifestYaml($.prometheus_config_1), |
29 |
| - 'alerts.rules': $.util.manifestYaml($.prometheusAlerts_1), |
30 |
| - 'recording.rules': $.util.manifestYaml($.prometheusRules_1), |
31 |
| - }), |
32 |
| - ]}, |
| 7 | + prometheus_config_0:: self.prometheus_config, |
| 8 | + prometheus_config_1:: self.prometheus_config, |
| 9 | + |
| 10 | + prometheusAlerts_0:: self.prometheusAlerts, |
| 11 | + prometheusAlerts_1:: self.prometheusAlerts, |
| 12 | + |
| 13 | + prometheusRules_0:: self.prometheusRules, |
| 14 | + prometheusRules_1:: self.prometheusRules, |
| 15 | + |
| 16 | + local prom = self, |
| 17 | + |
| 18 | + prometheus_config_map:: {}, |
| 19 | + |
| 20 | + prometheus_config_maps: [ |
| 21 | + configMap.new('%s-config-0' % self.name) + |
| 22 | + 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), |
| 26 | + }), |
| 27 | + configMap.new('%s-config-1' % self.name) + |
| 28 | + 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), |
| 32 | + }), |
| 33 | + ], |
33 | 34 |
|
34 | 35 | prometheus_config_mount:: {},
|
35 | 36 |
|
36 | 37 | prometheus_config_file:: '/etc/$(POD_NAME)/prometheus.yml',
|
37 | 38 |
|
38 | 39 | prometheus_container+:: container.withEnv([
|
39 |
| - container.envType.fromFieldPath('POD_NAME', 'metadata.name'), |
40 |
| - ]), |
| 40 | + container.envType.fromFieldPath('POD_NAME', 'metadata.name'), |
| 41 | + ]), |
41 | 42 |
|
42 |
| - prometheus_statefulset: |
43 |
| - $.util.configVolumeMount('%s-config-0' % self.name, '/etc/prometheus-0') + |
44 |
| - $.util.configVolumeMount('%s-config-1' % self.name, '/etc/prometheus-1') + |
| 43 | + prometheus_statefulset+: |
| 44 | + k.util.configVolumeMount('%s-config-0' % self.name, '/etc/prometheus-0') + |
| 45 | + k.util.configVolumeMount('%s-config-1' % self.name, '/etc/prometheus-1') + |
45 | 46 | statefulset.mixin.spec.withReplicas(2),
|
46 | 47 | }
|
0 commit comments