|
13 | 13 | name:: error 'must specify name',
|
14 | 14 |
|
15 | 15 | _config:: $._config,
|
| 16 | + local _config = self._config, |
16 | 17 |
|
17 | 18 | local policyRule = $.rbac.v1beta1.policyRule,
|
18 | 19 |
|
|
30 | 31 |
|
31 | 32 | local container = $.core.v1.container,
|
32 | 33 |
|
33 |
| - prometheus_config_file:: '/etc/prometheus/prometheus.yml', |
| 34 | + prometheus_args:: { |
| 35 | + '--config.file': _config.prometheus_config_file, |
| 36 | + '--web.listen-address': _config.prometheus_port, |
| 37 | + '--web.external-url': '%(prometheus_external_hostname)s%(prometheus_path)s' % _config, |
| 38 | + '--web.enable-admin-api': true, |
| 39 | + '--web.enable-lifecycle': true, |
| 40 | + '--web.route-prefix': _config.prometheus_web_route_prefix, |
| 41 | + '--storage.tsdb.path': '/prometheus/data', |
| 42 | + '--storage.tsdb.wal-compression': true, |
| 43 | + }, |
34 | 44 |
|
35 | 45 | prometheus_container::
|
36 |
| - local _config = self._config; |
37 | 46 |
|
38 | 47 | container.new('prometheus', $._images.prometheus) +
|
39 | 48 | container.withPorts($.core.v1.containerPort.new('http-metrics', _config.prometheus_port)) +
|
40 |
| - container.withArgs([ |
41 |
| - '--config.file=' + self.prometheus_config_file, |
42 |
| - '--web.listen-address=:%s' % _config.prometheus_port, |
43 |
| - '--web.external-url=%(prometheus_external_hostname)s%(prometheus_path)s' % _config, |
44 |
| - '--web.enable-admin-api', |
45 |
| - '--web.enable-lifecycle', |
46 |
| - '--web.route-prefix=%s' % _config.prometheus_web_route_prefix, |
47 |
| - '--storage.tsdb.path=/prometheus/data', |
48 |
| - '--storage.tsdb.wal-compression', |
49 |
| - ]) + |
| 49 | + container.withArgs($.util.mapToArgs(self.prometheus_args) + |
50 | 50 | $.util.resourcesRequests('250m', '1536Mi') +
|
51 | 51 | $.util.resourcesLimits('500m', '2Gi'),
|
52 | 52 |
|
53 | 53 | prometheus_watch_container::
|
54 |
| - local _config = self._config; |
55 |
| - |
56 | 54 | container.new('watch', $._images.watch) +
|
57 | 55 | container.withArgs([
|
58 | 56 | '-v',
|
|
83 | 81 | $.util.configVolumeMount('%s-config' % self.name, '/etc/prometheus'),
|
84 | 82 |
|
85 | 83 | prometheus_statefulset:
|
86 |
| - local _config = self._config; |
87 |
| - |
88 | 84 | statefulset.new(self.name, 1, [
|
89 | 85 | self.prometheus_container + container.withVolumeMountsMixin(
|
90 | 86 | volumeMount.new('%s-data' % self.name, '/prometheus')
|
|
106 | 102 | local servicePort = service.mixin.spec.portsType,
|
107 | 103 |
|
108 | 104 | prometheus_service:
|
109 |
| - local _config = self._config; |
110 |
| - |
111 | 105 | $.util.serviceFor(self.prometheus_statefulset) +
|
112 | 106 | service.mixin.spec.withPortsMixin([
|
113 | 107 | servicePort.newNamed(
|
|
0 commit comments