diff --git a/charts/redirect/Chart.yaml b/charts/redirect/Chart.yaml index d514058..21efdd8 100644 --- a/charts/redirect/Chart.yaml +++ b/charts/redirect/Chart.yaml @@ -4,7 +4,7 @@ description: Redirect home: https://github.com/wyrihaximusnet/docker-redirect icon: https://helm.wyrihaximus.net/images/charts/redirect.png type: application -version: 0.9.4 +version: 0.9.5 kubeVersion: ^1.18 appVersion: random maintainers: diff --git a/charts/redirect/templates/ingress.yaml b/charts/redirect/templates/ingress.yaml index d4f9272..30bf046 100644 --- a/charts/redirect/templates/ingress.yaml +++ b/charts/redirect/templates/ingress.yaml @@ -1,44 +1,20 @@ {{- $fullName := include "commons.fullname" . -}} -{{- $hosts := .Values.redirect.hosts -}} -{{- $ingressHosts := .Values.redirect.ingressHosts -}} +{{- $hosts := concat (.Values.redirect.ingressHosts | mustDeepCopy) (.Values.redirect.hosts | mustDeepCopy | keys) -}} +{{- range $host := ($hosts | uniq) }} +--- apiVersion: networking.k8s.io/v1beta1 kind: Ingress metadata: - name: {{ $fullName }} + name: {{ $fullName }}-{{ $host | replace "." "-" }} labels: - {{- include "commons.labels" . | nindent 4 }} - {{- with .Values.ingress.annotations }} + {{- include "commons.labels" $ | nindent 4 }} + {{- with $.Values.ingress.annotations }} annotations: {{- toYaml . | nindent 4 }} {{- end }} spec: tls: - {{- if $hosts -}} - {{- range $hostFrom, $hostTo := $hosts }} - {{- $host := dict "Host" $hostFrom -}} - {{ include "redirect.hostTLS" $host | nindent 4 }} - {{- end }} - {{- end }} - {{- if $ingressHosts -}} - {{- range $host := $ingressHosts }} - {{- if eq (hasKey $hosts $host) false -}} - {{- $host := dict "Host" $host -}} - {{ include "redirect.hostTLS" $host | nindent 4 }} - {{- end }} - {{- end }} - {{- end }} + {{ include "redirect.hostTLS" (dict "Host" $host) | nindent 4 }} rules: - {{- if $hosts -}} - {{- range $hostFrom, $hostTo := $hosts }} - {{- $host := dict "Host" $hostFrom "FullName" $fullName "SvcPort" 7132 -}} - {{ include "redirect.hostRule" $host | nindent 4 }} - {{- end }} - {{- end }} - {{- if $ingressHosts -}} - {{- range $host := $ingressHosts }} - {{- if eq (hasKey $hosts $host) false -}} - {{- $host := dict "Host" $host "FullName" $fullName "SvcPort" 7132 -}} - {{ include "redirect.hostRule" $host | nindent 4 }} - {{- end }} - {{- end }} - {{- end }} + {{ include "redirect.hostRule" (dict "Host" $host "FullName" $fullName "SvcPort" 7132) | nindent 4 }} +{{- end }}