2021-09-03 17:52:32 +00:00
|
|
|
{{- $values := .Values }}
|
2021-09-03 18:32:44 +00:00
|
|
|
{{- $namespace := ( printf "ix-%s" .Release.Name ) }}
|
2021-09-03 17:52:32 +00:00
|
|
|
{{- if or ( not .Values.ingressClass.enabled ) ( and ( .Values.ingressClass.enabled ) ( .Values.ingressClass.isDefaultClass ) ) }}
|
2021-09-04 09:07:09 +00:00
|
|
|
{{- $namespace = "default" }}
|
2021-09-03 17:52:32 +00:00
|
|
|
{{- end }}
|
2021-09-03 12:43:21 +00:00
|
|
|
{{ range $index, $middlewareData := .Values.middlewares.basicAuth }}
|
|
|
|
---
|
|
|
|
{{- $users := list }}
|
|
|
|
{{ range $index, $userdata := $middlewareData.users }}
|
|
|
|
{{ $users = append $users ( htpasswd $userdata.username $userdata.password ) }}
|
|
|
|
{{ end }}
|
|
|
|
|
|
|
|
apiVersion: v1
|
|
|
|
kind: Secret
|
|
|
|
metadata:
|
|
|
|
name: {{printf "%v-%v" $middlewareData.name "secret" }}
|
2021-09-03 17:34:31 +00:00
|
|
|
namespace: {{ $namespace }}
|
2021-09-03 12:43:21 +00:00
|
|
|
type: Opaque
|
|
|
|
stringData:
|
|
|
|
users: |
|
|
|
|
{{- range $index, $user := $users }}
|
|
|
|
{{ printf "%s" $user }}
|
|
|
|
{{- end }}
|
|
|
|
---
|
|
|
|
# Declaring the user list
|
|
|
|
apiVersion: traefik.containo.us/v1alpha1
|
|
|
|
kind: Middleware
|
|
|
|
metadata:
|
|
|
|
name: {{ $middlewareData.name }}
|
2021-09-03 17:34:31 +00:00
|
|
|
namespace: {{ $namespace }}
|
2021-09-03 12:43:21 +00:00
|
|
|
spec:
|
|
|
|
basicAuth:
|
|
|
|
secret: {{printf "%v-%v" $middlewareData.name "secret" }}
|
|
|
|
{{ end }}
|