Skip to content
Snippets Groups Projects
Commit 1ffd6dfb authored by Blizter's avatar Blizter
Browse files

let example generate

parent 7c748b98
Branches master
No related tags found
No related merge requests found
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,
...@@ -11,18 +11,25 @@ local configmap(name, namespace, data) = { ...@@ -11,18 +11,25 @@ local configmap(name, namespace, 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+:: {
alertmanager+: { alertmanager+: {
spec+: { spec+: {
# the important field configmaps: // the important field configmaps:
configMaps: ['alert-templates',], # goes to etc/alermanager/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) }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment