Skip to content

Commit 97b0792

Browse files
committed
Move httpConfig setup to a method so it's opt in
1 parent 9d5c429 commit 97b0792

File tree

2 files changed

+22
-8
lines changed

2 files changed

+22
-8
lines changed

static-exporter/jsonnetfile.json

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,15 @@
11
{
22
"version": 1,
33
"dependencies": [
4+
{
5+
"source": {
6+
"git": {
7+
"remote": "https://github.com/grafana/jsonnet-libs.git",
8+
"subdir": ""
9+
}
10+
},
11+
"version": "static-exporters-add-content-type-headers"
12+
},
413
{
514
"source": {
615
"git": {

static-exporter/main.libsonnet

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,6 @@ local k = import 'ksonnet-util/kausal.libsonnet';
77
local configMap = k.core.v1.configMap,
88
configmap:
99
configMap.new(name, self.data),
10-
httpdConfig:
11-
configMap.new(name + '-httpd-config')
12-
+ configMap.withData({
13-
'httpd.conf': importstr 'httpd.conf',
14-
}),
1510

1611
local container = k.core.v1.container,
1712
container::
@@ -26,9 +21,7 @@ local k = import 'ksonnet-util/kausal.libsonnet';
2621
local volumeMount = k.core.v1.volumeMount,
2722
deployment:
2823
deployment.new(name, replicas=1, containers=[self.container])
29-
+ k.util.configMapVolumeMount(self.configmap, '/usr/local/apache2/htdocs')
30-
+ k.util.configMapVolumeMount(self.httpdConfig, '/usr/local/apache2/conf/httpd.conf', volumeMount.withSubPath('httpd.conf')),
31-
24+
+ k.util.configMapVolumeMount(self.configmap, '/usr/local/apache2/htdocs'),
3225
},
3326

3427
withData(data):: { data: data },
@@ -54,6 +47,18 @@ local k = import 'ksonnet-util/kausal.libsonnet';
5447
),
5548
}),
5649

50+
withHttpConfig():: {
51+
local configMap = k.core.v1.configMap,
52+
local volumeMount = k.core.v1.volumeMount,
53+
httpdConfig:
54+
configMap.new('httpd-config')
55+
+ configMap.withData({
56+
'httpd.conf': importstr 'httpd.conf',
57+
}),
58+
deployment+:
59+
k.util.configMapVolumeMount(self.httpdConfig, '/usr/local/apache2/conf/httpd.conf', volumeMount.withSubPath('httpd.conf')),
60+
},
61+
5762
metric:: {
5863
new(name, description)::
5964
self.withName(name)

0 commit comments

Comments
 (0)