Skip to content

Commit c2eec98

Browse files
authored
Add withQueriesYaml() method to postgres-exporter (#1188)
* Add withQueriesYaml() method to postgres-exporter We need this file in order to use PG_EXPORTER_EXTEND_QUERY_PATH. * Add postgres-exporter version disclaimer
1 parent b5e3f0e commit c2eec98

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

postgres-exporter/main.libsonnet

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ local k = import 'ksonnet-util/kausal.libsonnet';
66
data_source_uri='$(HOSTNAME):$(PORT)/postgres',
77
data_source_name='',
88
ssl=true,
9+
// Note that upgrading to an image version greater than 0.12.1
10+
// will break dependencies using `withQueriesYaml`.
911
image='quay.io/prometheuscommunity/postgres-exporter:v0.10.0',
1012
):: {
1113
local this = self,
@@ -79,4 +81,22 @@ local k = import 'ksonnet-util/kausal.libsonnet';
7981
),
8082
]),
8183
},
84+
85+
// Upgrading to an image version greater than 0.12.1
86+
// will break this function.
87+
withQueriesYaml(content):: {
88+
container+:
89+
k.core.v1.container.withVolumeMounts([
90+
k.core.v1.volumeMount.new(
91+
'queries-yaml',
92+
'/etc/pg_exporter/queries.yaml',
93+
),
94+
])
95+
+ k.core.v1.configMap.new('queries-yaml', {
96+
'queries.yaml': content,
97+
})
98+
+ k.core.v1.container.withEnvMixin([
99+
envVar.new('PG_EXPORTER_EXTEND_QUERY_PATH', '/etc/pg_exporter/queries.yaml'),
100+
]),
101+
},
82102
}

0 commit comments

Comments
 (0)