Skip to content

Commit

Permalink
Add Ingress trailing / rewrite (#897)
Browse files Browse the repository at this point in the history
  • Loading branch information
migmartri authored Dec 28, 2018
1 parent d8e818d commit 07749fa
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
13 changes: 13 additions & 0 deletions chart/kubeapps/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -131,3 +131,16 @@ Create name for the tiller-proxy based on the fullname
{{- define "kubeapps.tiller-proxy.fullname" -}}
{{ template "kubeapps.fullname" . }}-internal-tiller-proxy
{{- end -}}

{{/*
Nginx rewrite rules that will add trailing slash to the provided custom ingress paths
Trailing / is required for the react app to work
*/}}
{{- define "kubeapps.ingressRewrites" -}}
{{ range .Values.ingress.hosts -}}
{{- if ne .path "/" -}}
rewrite ^({{ .path }})$ $1/ permanent;
{{- end -}}
{{- end }}
{{- end -}}

5 changes: 5 additions & 0 deletions chart/kubeapps/templates/ingress.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@ metadata:
release: {{ .Release.Name }}
heritage: {{ .Release.Service }}
annotations:
{{- $rewrites := include "kubeapps.ingressRewrites" . -}}
{{- if ne $rewrites ""}}
nginx.ingress.kubernetes.io/configuration-snippet: |
{{ template "kubeapps.ingressRewrites" $ }}
{{- end -}}
{{- if .Values.ingress.certManager }}
kubernetes.io/tls-acme: "true"
{{- end }}
Expand Down

0 comments on commit 07749fa

Please sign in to comment.