@@ -212,8 +212,7 @@ local k = import 'ksonnet/ksonnet.beta.4/k.libsonnet';
212
212
withRules:: {
213
213
local tr = self ,
214
214
config+:: {
215
- ruleConfigMapName: error 'must provide ruleConfigMapName' ,
216
- ruleFilesKey: error 'must provide ruleFilesKey' ,
215
+ rulesConfig: error 'must provide rulesConfig' ,
217
216
},
218
217
219
218
statefulSet+: {
@@ -223,20 +222,22 @@ local k = import 'ksonnet/ksonnet.beta.4/k.libsonnet';
223
222
containers: [
224
223
if c.name == 'thanos-rule' then c {
225
224
args+: [
226
- '--rule-file=/etc/thanos/rules/' + ruleFileKey ,
227
- for ruleFileKey in tr.config.ruleFilesKey
225
+ '--rule-file=/etc/thanos/rules/' + ruleConfig.name + '/' + ruleConfig.key ,
226
+ for ruleConfig in std.objectFields ( tr.config.rulesConfig)
228
227
],
229
228
volumeMounts+: [
230
- { name: 'rules-config' , mountPath: '/etc/thanos/rules' },
229
+ { name: ruleConfig.name, mountPath: '/etc/thanos/rules/' + ruleConfig.name },
230
+ for ruleConfig in std.objectFields (tr.config.rulesConfig)
231
231
],
232
232
} else c
233
233
for c in super .containers
234
234
],
235
235
236
236
local volume = k.apps.v1.statefulSet.mixin.spec.template.spec.volumesType,
237
237
volumes+: [
238
- volume.withName('rules-config' ) +
239
- volume.mixin.configMap.withName(tr.config.ruleConfigMapName),
238
+ volume.withName(ruleConfig.name) +
239
+ volume.mixin.configMap.withName(ruleConfig.name),
240
+ for ruleConfig in std.objectFields (tr.config.rulesConfig)
240
241
],
241
242
},
242
243
},
0 commit comments