From 184a6a452b880e43c95d9b0e66a792645f1b32a8 Mon Sep 17 00:00:00 2001 From: machinly Date: Fri, 14 May 2021 14:35:44 +0800 Subject: [PATCH 1/2] add grafana ldap support (cherry picked from commit ce7007c568e3126119250946ae6a447b9bd8cda5) --- jsonnet/kube-prometheus/components/grafana.libsonnet | 2 ++ 1 file changed, 2 insertions(+) diff --git a/jsonnet/kube-prometheus/components/grafana.libsonnet b/jsonnet/kube-prometheus/components/grafana.libsonnet index ce6cb40e48..0e1b81b923 100644 --- a/jsonnet/kube-prometheus/components/grafana.libsonnet +++ b/jsonnet/kube-prometheus/components/grafana.libsonnet @@ -27,6 +27,7 @@ local defaults = { containers: [], datasources: [], config: {}, + ldap: null, plugins: [], env: [], }; @@ -57,6 +58,7 @@ function(params) { folderDashboards: g._config.folderDashboards, containers: g._config.containers, config+: g._config.config, + ldap: g._config.ldap, plugins+: g._config.plugins, env: g._config.env, } + ( From 822f885d67d041069be2364e2b6905a21d20a88f Mon Sep 17 00:00:00 2001 From: Andrei Nistor Date: Thu, 14 Oct 2021 17:57:44 +0300 Subject: [PATCH 2/2] add grafana ldap example (cherry picked from commit 882484daf10f7d7a481eb759685844c1c084c9c9) --- examples/grafana-ldap.jsonnet | 36 +++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 examples/grafana-ldap.jsonnet diff --git a/examples/grafana-ldap.jsonnet b/examples/grafana-ldap.jsonnet new file mode 100644 index 0000000000..619c6fbd2a --- /dev/null +++ b/examples/grafana-ldap.jsonnet @@ -0,0 +1,36 @@ +local kp = + (import 'kube-prometheus/main.libsonnet') + + { + values+:: { + common+: { + namespace: 'monitoring', + }, + grafana+: { + config+: { + sections: { + 'auth.ldap': { + enabled: true, + config_file: '/etc/grafana/ldap.toml', + allow_sign_up: true, + }, + }, + }, + ldap: ||| + [[servers]] + host = "127.0.0.1" + port = 389 + use_ssl = false + start_tls = false + ssl_skip_verify = false + + bind_dn = "cn=admins,dc=example,dc=com" + bind_password = 'grafana' + + search_filter = "(cn=%s)" + search_base_dns = ["dc=example,dc=com"] + |||, + }, + }, + }; + +{ ['grafana-' + name]: kp.grafana[name] for name in std.objectFields(kp.grafana) }