Verified Commit 71dc6589 authored by Hugo's avatar Hugo
Browse files

add redirects

parent aa56d9f1
{{ if .Capabilities.APIVersions.Has "networking.k8s.io/v1/Ingress" }}
{{- range $i, $val := .Values.ingress.redirects }}
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
annotations:
kubernetes.io/tls-acme: "true"
{{- if $val.permanent }}
nginx.ingress.kubernetes.io/permanent-redirect: https://{{ tpl $.Values.domain $ }}
{{- else }}
nginx.ingress.kubernetes.io/temporal-redirect: https://{{ tpl $.Values.domain $ }}
{{- end }}
labels:
{{- include "hedgedoc.labels" $ | nindent 4 }}
name: {{ tpl $.Values.fqdn $ }}-redirect-{{ $i }}
spec:
rules:
- host: {{ $val.domain }}
http:
paths:
- backend:
service:
name: {{ tpl $.Values.fqdn $ }}-app
port:
name: http
path: /
pathType: Prefix
tls:
- hosts:
- {{ $val.domain }}
secretName: {{ tpl $.Values.fqdn $ }}-redirect-{{ $i }}-tls
{{ end -}}
{{ end }}
\ No newline at end of file
{{ if not (.Capabilities.APIVersions.Has "networking.k8s.io/v1/Ingress") }}
{{- range $i, $val := .Values.ingress.redirects }}
apiVersion: networking.k8s.io/v1beta1
kind: Ingress
metadata:
annotations:
kubernetes.io/tls-acme: "true"
{{- if $val.permanent }}
nginx.ingress.kubernetes.io/permanent-redirect: https://{{ tpl $.Values.domain $ }}
{{- else }}
nginx.ingress.kubernetes.io/temporal-redirect: https://{{ tpl $.Values.domain $ }}
{{- end }}
labels:
{{- include "hedgedoc.labels" $ | nindent 4 }}
name: {{ tpl $.Values.fqdn $ }}-redirect-{{ $i }}
spec:
rules:
- host: {{ $val.domain }}
http:
paths:
- backend:
serviceName: {{ tpl $.Values.fqdn $ }}-app
servicePort: http
path: /
tls:
- hosts:
- {{ $val.domain }}
secretName: {{ tpl $.Values.fqdn $ }}-redirect-{{ $i }}-tls
{{ end -}}
{{ end }}
\ No newline at end of file
......@@ -24,3 +24,6 @@ pg:
credentialsSuffix: ".credentials"
autoMigrateDomain: true
ingress:
redirect: []
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment