|
13 | 13 |
|
14 | 14 | // Generates yaml string containing datasource config
|
15 | 15 | grafana_datasource(name, url, default=false, method='GET')::
|
16 |
| - $.util.manifestYaml({ |
| 16 | + { |
17 | 17 | apiVersion: 1,
|
18 | 18 | datasources: [{
|
19 | 19 | name: name,
|
|
27 | 27 | httpMethod: method,
|
28 | 28 | },
|
29 | 29 | }],
|
30 |
| - }), |
| 30 | + }, |
31 | 31 |
|
32 | 32 | /*
|
33 | 33 | helper to allow adding datasources directly to the datasource_config_map
|
|
38 | 38 | */
|
39 | 39 | grafana_add_datasource(name, url, default=false, method='GET')::
|
40 | 40 | configMap.withDataMixin({
|
41 |
| - ['%s.yml' % name]: $.grafana_datasource(name, url, default, method), |
| 41 | + ['%s.yml' % name]: $.util.manifestYaml($.grafana_datasource(name, url, default, method)), |
42 | 42 | }),
|
43 | 43 |
|
44 | 44 | // Generates yaml string containing datasource config
|
45 | 45 | grafana_datasource_with_basicauth(name, url, username, password, default=false, method='GET')::
|
46 |
| - $.util.manifestYaml({ |
| 46 | + { |
47 | 47 | apiVersion: 1,
|
48 | 48 | datasources: [{
|
49 | 49 | name: name,
|
|
60 | 60 | httpMethod: method,
|
61 | 61 | },
|
62 | 62 | }],
|
63 |
| - }), |
| 63 | + }, |
64 | 64 |
|
65 | 65 | /*
|
66 | 66 | helper to allow adding datasources directly to the datasource_config_map
|
|
71 | 71 | */
|
72 | 72 | grafana_add_datasource_with_basicauth(name, url, username, password, default=false, method='GET')::
|
73 | 73 | configMap.withDataMixin({
|
74 |
| - ['%s.yml' % name]: $.grafana_datasource_with_basicauth(name, url, username, password, default, method), |
| 74 | + ['%s.yml' % name]: $.util.manifestYaml($.grafana_datasource_with_basicauth(name, url, username, password, default, method)), |
75 | 75 | }),
|
76 | 76 |
|
77 | 77 | grafana_datasource_config_map:
|
78 | 78 | configMap.new('grafana-datasources') +
|
79 | 79 | configMap.withDataMixin({
|
80 |
| - [name]: std.toString($.grafanaDatasources[name]) |
| 80 | + [name]: ( |
| 81 | + if std.isString($.grafanaDatasources[name]) then |
| 82 | + $.grafanaDatasources[name] |
| 83 | + else |
| 84 | + $.util.manifestYaml($.grafanaDatasources[name]) |
| 85 | + ) |
81 | 86 | for name in std.objectFields($.grafanaDatasources)
|
82 | 87 | }) +
|
83 | 88 | configMap.mixin.metadata.withLabels($._config.grafana_datasource_labels),
|
|
0 commit comments