ingress-redirects.yaml 1.04 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
{{- if .Values.service.redirectHosts }}
{{- if .Values.service.enabled -}}
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: {{ template "fullname" . }}-redirects
  labels:
    app: {{ template "appname" . }}
    chart: "{{ .Chart.Name }}-{{ .Chart.Version| replace "+" "_" }}"
    release: {{ .Release.Name }}
    heritage: {{ .Release.Service }}
  annotations:
    ingress.kubernetes.io/configuration-snippet: "return 301 $scheme://{{ template "hostname" .Values.service.url }}$request_uri;"
spec:
{{- if .Values.ingress.tls.enabled }}
  tls:
  - hosts:
{{- range $host := .Values.service.redirectHosts }}
    - {{ $host }}
{{- end -}}
    secretName: {{ .Values.ingress.tls.secretName | default (printf "%s-redirects-tls" (include "fullname" .)) }}
{{- end }}
  rules:   
Dominik Hebeler's avatar
Dominik Hebeler committed
24
{{- range $host := .Values.service.redirectHosts }}
25 26 27 28 29 30 31 32 33 34
  - host: {{ $host }}
    http:
      paths:
      - path: /
        backend:
          serviceName: {{ template "fullname" . }}
          servicePort: {{ .Values.service.externalPort }}
{{- end -}}
{{- end }}
{{- end }}