Skip to content

Commit 00f26dd

Browse files
authored
Merge pull request #42 from kubero-dev/feature/add-basic-auth
Feature / Add basic auth
2 parents f5a2738 + 94ec399 commit 00f26dd

File tree

4 files changed

+32
-2
lines changed

4 files changed

+32
-2
lines changed

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
0.1.6
1+
0.1.7-rc.7

helm-charts/kuberoapp/templates/ingress.yaml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,15 @@ metadata:
1818
name: {{ $fullName }}
1919
labels:
2020
{{- include "kuberoapp.labels" . | nindent 4 }}
21-
{{- with .Values.ingress.annotations }}
2221
annotations:
22+
{{- with .Values.ingress.annotations }}
2323
{{- toYaml . | nindent 4 }}
2424
{{- end }}
25+
{{- if .Values.basicAuth.enabled }}
26+
nginx.ingress.kubernetes.io/auth-secret: {{ include "kuberoapp.fullname" . }}-htpasswd
27+
nginx.ingress.kubernetes.io/auth-type: basic
28+
nginx.ingress.kubernetes.io/auth-realm: {{ .Values.basicAuth.realm | quote }}
29+
{{- end }}
2530
spec:
2631
{{- if and .Values.ingress.className (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion) }}
2732
ingressClassName: {{ .Values.ingress.className }}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{{- if gt (len .Values.basicAuth.accounts) 0 }}
2+
{{- $accounts := .Values.basicAuth.accounts }}
3+
{{- $val := "" }}
4+
{{- range $account := $accounts }}
5+
{{- $val = printf "%s%s\n" $val $account.hash }}
6+
{{- end }}
7+
apiVersion: v1
8+
kind: Secret
9+
metadata:
10+
name: {{ include "kuberoapp.fullname" . }}-htpasswd
11+
type: Opaque
12+
data:
13+
auth: {{ $val | trimSuffix "\n" | b64enc }}
14+
{{- end }}

helm-charts/kuberoapp/values.yaml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,17 @@ resources: {}
158158
# cpu: 100m
159159
# memory: 128Mi
160160

161+
basicAuth:
162+
enabled: false
163+
realm: "Protected"
164+
accounts: []
165+
#- user: foo
166+
# pass: bar
167+
# hash: ""
168+
#- user: bar
169+
# pass: foo
170+
# hash: ""
171+
161172
autoscaling:
162173
enabled: false
163174

0 commit comments

Comments
 (0)