From 7897a366d86ec13dd6501f991aab58eba301ca01 Mon Sep 17 00:00:00 2001 From: Wilfrido Vidana <4426659+wvidana@users.noreply.github.com> Date: Mon, 17 Jun 2019 08:22:09 -0500 Subject: [PATCH] [stable/cerebro] Enables use of Cerebro provided auth (#14506) * Adding auth options, based on env vars Imported from app, https://github.com/lmenezes/cerebro/blob/f2ed031fd89258c6ad85d40d846f5ff1f610fe73/conf/application.conf Signed-off-by: Wilfrido Vidana * Ability to use env vars from a secret reference Signed-off-by: Wilfrido Vidana * Update README with more info Signed-off-by: Wilfrido Vidana * Verison bump - new functionality Signed-off-by: Wilfrido Vidana * Update stable/cerebro/Chart.yaml Co-Authored-By: David J. M. Karlsen Signed-off-by: Wilfrido Vidana --- stable/cerebro/Chart.yaml | 2 +- stable/cerebro/README.md | 2 ++ stable/cerebro/templates/configmap.yaml | 21 +++++++++++++++++++++ stable/cerebro/templates/deployment.yaml | 5 +++++ stable/cerebro/values.yaml | 3 +++ 5 files changed, 32 insertions(+), 1 deletion(-) diff --git a/stable/cerebro/Chart.yaml b/stable/cerebro/Chart.yaml index b091d265d3..c27f5e5136 100644 --- a/stable/cerebro/Chart.yaml +++ b/stable/cerebro/Chart.yaml @@ -1,5 +1,5 @@ name: cerebro -version: 1.0.2 +version: 1.1.0 appVersion: 0.8.3 apiVersion: v1 description: A Helm chart for Cerebro - a web admin tool that replaces Kopf. diff --git a/stable/cerebro/README.md b/stable/cerebro/README.md index a400109951..18a8defc7b 100644 --- a/stable/cerebro/README.md +++ b/stable/cerebro/README.md @@ -6,6 +6,7 @@ Cerebro is an open source (MIT License) elasticsearch web admin tool built using This chart deploys Cerebro to your cluster via a Deployment and Service. Optionally you can also enable ingress. +Optionally you can use cerebro provided auth by uploading a Secret with the needed env vars (don't forget to set `AUTH_TYPE`). # Prerequisites @@ -61,6 +62,7 @@ The following table lists the configurable parameters of the cerebro chart and t | `nodeSelector` | Settings for nodeselector | `{}` | | `tolerations` | Settings for toleration | `{}` | | `affinity` | Settings for affinity | `{}` | +| `envFromSecretRef` | Reference to Secret with env vars | | | `config.basePath` | Application base path | `/` | | `config.restHistorySize` | Rest request history size per user | `50` | | `config.hosts` | A list of known hosts | `[]` | diff --git a/stable/cerebro/templates/configmap.yaml b/stable/cerebro/templates/configmap.yaml index 245ff020fa..9a67f8dc30 100644 --- a/stable/cerebro/templates/configmap.yaml +++ b/stable/cerebro/templates/configmap.yaml @@ -28,6 +28,27 @@ data: } auth = { + # either basic or ldap + type: ${?AUTH_TYPE} + settings { + # LDAP + url = ${?LDAP_URL} + base-dn = ${?LDAP_BASE_DN} + method = ${?LDAP_METHOD} + user-template = ${?LDAP_USER_TEMPLATE} + bind-dn = ${?LDAP_BIND_DN} + bind-pw = ${?LDAP_BIND_PWD} + group-search { + base-dn = ${?LDAP_GROUP_BASE_DN} + user-attr = ${?LDAP_USER_ATTR} + user-attr-template = ${?LDAP_USER_ATTR_TEMPLATE} + group = ${?LDAP_GROUP} + } + + # Basic auth + username = ${?BASIC_AUTH_USER} + password = ${?BASIC_AUTH_PWD} + } } hosts = [ diff --git a/stable/cerebro/templates/deployment.yaml b/stable/cerebro/templates/deployment.yaml index 1c06fa7f27..0059900770 100644 --- a/stable/cerebro/templates/deployment.yaml +++ b/stable/cerebro/templates/deployment.yaml @@ -54,6 +54,11 @@ spec: mountPath: /var/db/cerebro - name: config mountPath: /etc/cerebro + {{- if .Values.envFromSecretRef }} + envFrom: + - secretRef: + name: "{{ .Values.envFromSecretRef }}" + {{- end }} livenessProbe: httpGet: path: / diff --git a/stable/cerebro/values.yaml b/stable/cerebro/values.yaml index e65c63bce7..0b5ebe6bbe 100644 --- a/stable/cerebro/values.yaml +++ b/stable/cerebro/values.yaml @@ -52,6 +52,9 @@ tolerations: [] affinity: {} +# Reference to a Secret object with environment variables +# envFromSecretRef: 'my-secret-ref' + config: basePath: '/' restHistorySize: 50