Skip to content

Commit

Permalink
Fix ingress for lighthouse connection
Browse files Browse the repository at this point in the history
  • Loading branch information
martina-if committed Oct 12, 2020
1 parent 34f6182 commit d517a32
Showing 1 changed file with 44 additions and 2 deletions.
46 changes: 44 additions & 2 deletions contrib/chart/backstage/templates/ingress.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@ metadata:
name: {{ include "backstage.fullname" . }}-ingress
{{- with .Values.ingress.annotations }}
annotations:
nginx.ingress.kubernetes.io/ssl-redirect: "false"
nginx.ingress.kubernetes.io/configuration-snippet: |
if ($scheme = https) {
add_header Strict-Transport-Security "max-age=0;";
}
{{- toYaml . | nindent 4 }}
{{- end }}
spec:
Expand All @@ -18,6 +23,8 @@ spec:
backend:
serviceName: {{ include "frontend.serviceName" . }}
servicePort: 80
{{/* Route the backend inside the same hostname as the frontend when they are the same */}}
{{- if eq $frontendUrl.host $backendUrl.host}}
- path: /techdocs
backend:
serviceName: {{ include "backend.serviceName" . }}
Expand All @@ -26,18 +33,53 @@ spec:
backend:
serviceName: {{ include "backend.serviceName" . }}
servicePort: 80
- path: /api
backend:
serviceName: {{ include "backend.serviceName" . }}
servicePort: 80
{{/* Route the backend through a different host */}}
{{- else -}}
- host: {{ $backendUrl.host }}
http:
paths:
- path: {{ $backendUrl.path | default "/" }}
backend:
serviceName: {{ include "backend.serviceName" . }}
servicePort: 80
- host: {{ $lighthouseUrl.host }}
{{- end }}
{{/* Route lighthouse through a different host */}}
{{- if not ( eq $frontendUrl.host $lighthouseUrl.host ) }}
- host: {{ $lighthouseUrl.host }}
http:
paths:
- path: {{ $lighthouseUrl.path | default "/" }}
backend:
serviceName: {{ include "lighthouse.serviceName" . }}
servicePort: 80

{{- else }}
{{/* Route lighthouse by path with re-write rules when it is hosted under the same hostname */}}
---
apiVersion: networking.k8s.io/v1beta1
kind: Ingress
metadata:
name: {{ include "backstage.fullname" . }}-ingress-lighthouse
{{- with .Values.ingress.annotations }}
annotations:
nginx.ingress.kubernetes.io/rewrite-target: /$2
nginx.ingress.kubernetes.io/ssl-redirect: "false"
nginx.ingress.kubernetes.io/configuration-snippet: |
if ($scheme = https) {
add_header Strict-Transport-Security "max-age=0;";
}
{{- toYaml . | nindent 4 }}
{{- end }}
spec:
rules:
- host: {{ $frontendUrl.host }}
http:
paths:
- path: {{$lighthouseUrl.path}}(/|$)(.*)
backend:
serviceName: {{ include "lighthouse.serviceName" . }}
servicePort: 80
{{- end }}

0 comments on commit d517a32

Please sign in to comment.