let example generate

This commit is contained in:
Blizter
2021-10-24 09:31:28 -04:00
parent 7c748b987b
commit 1ffd6dfb30

View File

@@ -1,28 +1,35 @@
local configmap(name, namespace, data) = { local configmap(name, namespace, data) = {
apiVersion: "v1", apiVersion: 'v1',
kind: "ConfigMap", kind: 'ConfigMap',
metadata : { metadata: {
name: name, name: name,
namespace: namespace, namespace: namespace,
}, },
data: data, data: data,
}; };
local kp = local kp =
// different libsonnet imported // different libsonnet imported
{ {
configmap+:: { values+:: {
'alert-templates': configmap( common+: {
'alertmanager-alert-template.tmpl', namespace: 'monitoring',
$._config.namespace,
{"data": importstr 'alertmanager-alert-template.tmpl'},
)
}, },
alertmanager+:{ },
spec+:{ alertmanager+:: {
# the important field configmaps: alertmanager+: {
configMaps: ['alert-templates',], # goes to etc/alermanager/configmaps spec+: {
}, // the important field configmaps:
configMaps: ['alert-templates'], // goes to etc/alermanager/configmaps
},
}, },
}; },
configmap+:: {
'alert-templates': configmap(
'alertmanager-alert-template.tmpl',
$.values.common.namespace, // could be $._config.namespace to assign namespace once
{ data: importstr 'alertmanager-alert-template.tmpl' },
),
},
};
{ [name + '-configmap']: kp.configmap[name] for name in std.objectFields(kp.configmap) } { [name + '-configmap']: kp.configmap[name] for name in std.objectFields(kp.configmap) }