Skip to content

Commit

Permalink
allow to create a secret for basic auth
Browse files Browse the repository at this point in the history
This allows to create a secret which can be used for basic
authentication in ingresses

Signed-off-by: nick <nick@nine.ch>
  • Loading branch information
thirdeyenick committed Jul 21, 2021
1 parent 8a8f4fd commit 37c4841
Show file tree
Hide file tree
Showing 4 changed files with 62 additions and 1 deletion.
2 changes: 1 addition & 1 deletion charts/kube-prometheus-stack/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ name: kube-prometheus-stack
sources:
- https://github.com/prometheus-community/helm-charts
- https://github.com/prometheus-operator/kube-prometheus
version: 16.15.0
version: 16.16.0
appVersion: 0.48.1
kubeVersion: ">=1.16.0-0"
home: https://github.com/prometheus-operator/kube-prometheus
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{{- if .Values.alertmanager.basicAuthSecret.data -}}
apiVersion: v1
kind: Secret
metadata:
name: alertmanager-{{ template "kube-prometheus-stack.fullname" . }}-basic-auth
namespace: {{ template "kube-prometheus-stack.namespace" . }}
{{- if .Values.alertmanager.basicAuthSecret.annotations }}
annotations:
{{ toYaml .Values.alertmanager.basicAuthSecret.annotations | indent 4 }}
{{- end }}
labels:
app: {{ template "kube-prometheus-stack.name" . }}-alertmanager
app.kubernetes.io/component: alertmanager
{{ include "kube-prometheus-stack.labels" . | indent 4 }}
data:
{{- range $key, $val := .Values.alertmanager.basicAuthSecret.data }}
{{ $key }}: {{ $val | b64enc | quote }}
{{- end }}
{{- end }}
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{{- if .Values.prometheus.basicAuthSecret.data -}}
apiVersion: v1
kind: Secret
metadata:
name: prometheus-{{ template "kube-prometheus-stack.fullname" . }}-basic-auth
namespace: {{ template "kube-prometheus-stack.namespace" . }}
{{- if .Values.prometheus.basicAuthSecret.annotations }}
annotations:
{{ toYaml .Values.prometheus.basicAuthSecret.annotations | indent 4 }}
{{- end }}
labels:
app: {{ template "kube-prometheus-stack.name" . }}-prometheus
app.kubernetes.io/component: prometheus
{{ include "kube-prometheus-stack.labels" . | indent 4 }}
data:
{{- range $key, $val := .Values.prometheus.basicAuthSecret.data }}
{{ $key }}: {{ $val | b64enc | quote }}
{{- end }}
{{- end }}
23 changes: 23 additions & 0 deletions charts/kube-prometheus-stack/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,17 @@ alertmanager:
# hosts:
# - alertmanager.example.com

## Basic auth secret creation
## You might need to add annotations to the ingress depending on your
## ingress controller in use
##
basicAuthSecret:
annotations: {}
data: {}
# auth: |
# foo:$apr1$OFG3Xybp$ckL0FHDAkoXYIlH9.cysT0
# someoneelse:$apr1$DMZX2Z4q$6SbQIfyuLQd.xmo/P0m2c.

## Configuration for Alertmanager secret
##
secret:
Expand Down Expand Up @@ -1765,6 +1776,18 @@ prometheus:
# - secretName: thanos-gateway-tls
# hosts:
# - thanos-gateway.domain.com
#

## Basic auth secret creation
## You might need to add annotations to the ingress depending on your
## ingress controller in use
##
basicAuthSecret:
annotations: {}
data: {}
# auth: |
# foo:$apr1$OFG3Xybp$ckL0FHDAkoXYIlH9.cysT0
# someoneelse:$apr1$DMZX2Z4q$6SbQIfyuLQd.xmo/P0m2c.

ingress:
enabled: false
Expand Down

0 comments on commit 37c4841

Please sign in to comment.