From e0a960558b71ff37232046e1867fa647b3da4a5a Mon Sep 17 00:00:00 2001 From: Martina Iglesias Fernandez Date: Wed, 7 Oct 2020 15:50:27 +0200 Subject: [PATCH] Fix techdocs and CORS the cors setting was not loaded by the frontend because it can't see the app-config.yaml file so it needs to be part of the environment variables --- .../backstage/files/app-config.local.yaml.tpl | 6 ++++-- .../templates/backstage-app-config.yaml | 1 + .../chart/backstage/templates/ingress.yaml | 19 ++++++------------- contrib/chart/backstage/values.yaml | 6 +++--- 4 files changed, 14 insertions(+), 18 deletions(-) diff --git a/contrib/chart/backstage/files/app-config.local.yaml.tpl b/contrib/chart/backstage/files/app-config.local.yaml.tpl index f5e0b94225..646d438771 100644 --- a/contrib/chart/backstage/files/app-config.local.yaml.tpl +++ b/contrib/chart/backstage/files/app-config.local.yaml.tpl @@ -2,8 +2,6 @@ backend: lighthouseHostname: {{ include "lighthouse.serviceName" . | quote }} listen: port: {{ .Values.appConfig.backend.listen.port | default 7000 }} - cors: - origin: {{ .Values.appConfig.backend.cors.origin | quote }} database: client: {{ .Values.appConfig.backend.database.client | quote }} connection: @@ -43,3 +41,7 @@ sentry: scaffolder: azure: baseUrl: https://dev.azure.com/some-org + +techdocs: + generators: + techdocs: 'local' diff --git a/contrib/chart/backstage/templates/backstage-app-config.yaml b/contrib/chart/backstage/templates/backstage-app-config.yaml index e419e5d14a..987ad8e160 100644 --- a/contrib/chart/backstage/templates/backstage-app-config.yaml +++ b/contrib/chart/backstage/templates/backstage-app-config.yaml @@ -14,6 +14,7 @@ data: APP_CONFIG_app_baseUrl: {{ .Values.appConfig.app.baseUrl | quote | quote }} APP_CONFIG_app_title: {{ .Values.appConfig.app.title | quote | quote }} APP_CONFIG_backend_baseUrl: {{ .Values.appConfig.backend.baseUrl | quote | quote }} + APP_CONFIG_backend_cors_origin: {{ .Values.appConfig.backend.cors.origin | quote | quote }} APP_CONFIG_techdocs_storageUrl: {{ .Values.appConfig.techdocs.storageUrl | quote | quote }} APP_CONFIG_techdocs_requestUrl: {{ .Values.appConfig.techdocs.requestUrl | quote | quote }} APP_CONFIG_lighthouse_baseUrl: {{ .Values.appConfig.lighthouse.baseUrl | quote | quote }} diff --git a/contrib/chart/backstage/templates/ingress.yaml b/contrib/chart/backstage/templates/ingress.yaml index 481bacbfb3..7705d52a93 100644 --- a/contrib/chart/backstage/templates/ingress.yaml +++ b/contrib/chart/backstage/templates/ingress.yaml @@ -23,22 +23,14 @@ 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" . }} - servicePort: 80 - - path: /metadata - backend: - serviceName: {{ include "backend.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: /api backend: serviceName: {{ include "backend.serviceName" . }} servicePort: 80 -{{/* Route the backend through a different host */}} -{{- else -}} + {{/* Route the backend through a different host */}} + {{- else -}} - host: {{ $backendUrl.host }} http: paths: @@ -46,7 +38,8 @@ spec: backend: serviceName: {{ include "backend.serviceName" . }} servicePort: 80 -{{- end }} + {{- end }} + {{/* Route lighthouse through a different host */}} {{- if not ( eq $frontendUrl.host $lighthouseUrl.host ) }} - host: {{ $lighthouseUrl.host }} diff --git a/contrib/chart/backstage/values.yaml b/contrib/chart/backstage/values.yaml index ea9cd077f8..e307701249 100644 --- a/contrib/chart/backstage/values.yaml +++ b/contrib/chart/backstage/values.yaml @@ -102,10 +102,10 @@ appConfig: sentry: organization: spotify techdocs: - storageUrl: https://backend.example.com/techdocs/static/docs - requestUrl: https://backend.example.com/techdocs/docs + storageUrl: https://demo.example.com/api/techdocs/static/docs + requestUrl: https://demo.example.com/api/techdocs lighthouse: - baseUrl: https://lighthouse.example.com + baseUrl: https://demo.example.com/lighthouse-api rollbar: organization: roadie