Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions grafana/grafana.libsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ local defaults = {
limits: { cpu: '200m', memory: '200Mi' },
},

alertings: {},
dashboards: {},
rawDashboards: {},
folderDashboards: {},
Expand Down Expand Up @@ -86,6 +87,19 @@ function(params) {
} + if g._config.ldap != null then { 'ldap.toml': g._config.ldap } else {},
},

alertingsDefinition: {
apiVersion: 'v1',
kind: 'Secret',
type: 'Opaque',
metadata: g._metadata {
name: 'grafana-alertings',
},
stringData: {
[name]: std.manifestJsonEx(g._config.alertings[name], ' ')
for name in std.objectFields(g._config.alertings)
},
},

dashboardDefinitions: {
apiVersion: 'v1',
kind: 'ConfigMapList',
Expand Down Expand Up @@ -213,6 +227,16 @@ function(params) {
readOnly: false,
};

local alertingsVolume = {
name: 'grafana-alertings',
secret: { secretName: g.alertingsDefinition.metadata.name },
};
local alertingsVolumeMount = {
name: alertingsVolume.name,
mountPath: '/etc/grafana/provisioning/alerting',
readOnly: false,
};

local datasourcesVolume = {
name: 'grafana-datasources',
secret: { secretName: g.dashboardDatasources.metadata.name },
Expand Down Expand Up @@ -251,6 +275,7 @@ function(params) {
datasourcesVolumeMount,
dashboardsVolumeMount,
pluginTmpVolumeMount,
alertingsVolumeMount,
] +
[
{
Expand Down Expand Up @@ -280,6 +305,7 @@ function(params) {
datasourcesVolume,
dashboardsVolume,
pluginTmpVolume,
alertingsVolume,
] +
[
{
Expand Down