diff --git a/contrib/chart/backstage/files/app-config.local.yaml.tpl b/contrib/chart/backstage/files/app-config.local.yaml.tpl new file mode 100644 index 0000000000..7fdfeb79a8 --- /dev/null +++ b/contrib/chart/backstage/files/app-config.local.yaml.tpl @@ -0,0 +1,72 @@ +backend: + lighthouseHostname: {{ include "lighthouse.serviceName" . | quote }} + listen: {{ .Values.appConfig.backend.listen | quote }} + cors: + origin: {{ .Values.appConfig.backend.cors.origin | quote }} + database: + client: {{ .Values.appConfig.backend.database.client | quote }} + connection: + host: {{ include "backend.postgresql.host" . | quote }} + port: {{ include "backend.postgresql.port" . | quote }} + user: {{ include "backend.postgresql.user" . | quote }} + database: {{ .Values.appConfig.backend.database.connection.database | quote }} + ssl: + rejectUnauthorized: {{ .Values.appConfig.backend.database.connection.ssl.rejectUnauthorized | quote }} + ca: {{ include "backstage.backend.postgresCaFilename" . | quote }} + +catalog: + locations: + # Backstage example components + - type: github + target: https://github.com/spotify/backstage/blob/master/packages/catalog-model/examples/all-components.yaml + # Example component for github-actions + - type: github + target: https://github.com/spotify/backstage/blob/master/plugins/github-actions/examples/sample.yaml + # Example component for techdocs + - type: github + target: https://github.com/spotify/backstage/blob/master/plugins/techdocs-backend/examples/documented-component/documented-component.yaml + # Backstage example APIs + - type: github + target: https://github.com/spotify/backstage/blob/master/packages/catalog-model/examples/all-apis.yaml + # Backstage example templates + - type: github + target: https://github.com/spotify/backstage/blob/master/plugins/scaffolder-backend/sample-templates/all-templates.yaml + +sentry: + organization: {{ .Values.appConfig.sentry.organization | quote }} + +auth: + providers: + github: + development: + clientId: {{ .Values.auth.github.clientId }} + appOrigin: {{ .Values.appConfig.auth.providers.github.development.appOrigin | quote }} + google: + development: + clientId: {{ .Values.auth.google.clientId }} + appOrigin: {{ .Values.appConfig.auth.providers.google.development.appOrigin | quote }} + gitlab: + development: + clientId: {{ .Values.auth.gitlab.clientId }} + appOrigin: {{ .Values.appConfig.auth.providers.gitlab.development.appOrigin | quote }} + audience: {{ .Values.auth.gitlab.baseUrl }} + okta: + development: + clientId: {{ .Values.auth.okta.clientId }} + audience: {{ .Values.auth.okta.audience }} + appOrigin: {{ .Values.appConfig.auth.providers.okta.development.appOrigin | quote }} + oauth2: + development: + clientId: {{ .Values.auth.oauth2.clientId }} + tokenUrl: {{ .Values.auth.oauth2.tokenUrl }} + appOrigin: {{ .Values.appConfig.auth.providers.oauth2.development.appOrigin | quote }} + auth0: + development: + clientId: {{ .Values.auth.auth0.clientId }} + microsoft: + development: + clientId: {{ .Values.auth.microsoft.clientId }} + tenantId: {{ .Values.auth.microsoft.tenantId }} + +lighthouse: + baseUrl: {{ .Values.appConfig.lighthouse.baseUrl | quote }} diff --git a/contrib/chart/backstage/templates/_helpers.tpl b/contrib/chart/backstage/templates/_helpers.tpl index 9f3b1cfbdc..ec54c91d1b 100644 --- a/contrib/chart/backstage/templates/_helpers.tpl +++ b/contrib/chart/backstage/templates/_helpers.tpl @@ -277,3 +277,10 @@ Postgres password for lighthouse {{- required "A valid .Values.lighthouse.database.connection.password is required when postgresql is not enabled" $secretName -}} {{- end -}} {{- end -}} + +{{/* +app-config file name +*/}} +{{- define "backstage.appConfigFilename" -}} +{{- "app-config.local.yaml" -}} +{{- end -}} diff --git a/contrib/chart/backstage/templates/backend-deployment.yaml b/contrib/chart/backstage/templates/backend-deployment.yaml index 67177d7923..9c6e8da67c 100644 --- a/contrib/chart/backstage/templates/backend-deployment.yaml +++ b/contrib/chart/backstage/templates/backend-deployment.yaml @@ -30,12 +30,10 @@ spec: {{- toYaml .Values.backend.resources | nindent 12 }} envFrom: - - configMapRef: - name: {{ include "backstage.fullname" . }}-app - - configMapRef: - name: {{ include "backstage.fullname" . }}-auth - secretRef: name: {{ include "backstage.fullname" . }}-backend + - configMapRef: + name: {{ include "backstage.fullname" . }}-app-env env: - name: APP_CONFIG_backend_postgresPassword valueFrom: @@ -45,11 +43,17 @@ spec: volumeMounts: - name: postgres-ca mountPath: {{ include "backstage.backend.postgresCaDir" . }} + - name: app-config + mountPath: {{ printf "/usr/src/app/%s" (include "backstage.appConfigFilename" .) }} + subPath: {{ include "backstage.appConfigFilename" . }} volumes: - name: postgres-ca configMap: name: {{ include "backstage.fullname" . }}-postgres-ca + - name: app-config + configMap: + name: {{ include "backstage.fullname" . }}-app-config {{- if .Values.backend.enabled }} --- @@ -68,4 +72,4 @@ spec: component: backend type: ClusterIP -{{- end }} \ No newline at end of file +{{- end }} diff --git a/contrib/chart/backstage/templates/backstage-app-config.yaml b/contrib/chart/backstage/templates/backstage-app-config.yaml index be937cee13..a75fc8108d 100644 --- a/contrib/chart/backstage/templates/backstage-app-config.yaml +++ b/contrib/chart/backstage/templates/backstage-app-config.yaml @@ -1,27 +1,19 @@ apiVersion: v1 kind: ConfigMap metadata: - name: {{ include "backstage.fullname" . }}-app + name: {{ include "backstage.fullname" . }}-app-config +data: +{{ include "backstage.appConfigFilename" . | indent 2 }}: | +{{ tpl (.Files.Get "files/app-config.local.yaml.tpl") . | indent 4 }} +--- +apiVersion: v1 +kind: ConfigMap +metadata: + name: {{ include "backstage.fullname" . }}-app-env 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_lighthouseHostname: {{ include "lighthouse.serviceName" . | quote | quote }} - APP_CONFIG_backend_listen: {{ .Values.appConfig.backend.listen | quote | quote }} - APP_CONFIG_backend_cors_origin: {{ .Values.appConfig.backend.cors.origin | quote | quote }} - APP_CONFIG_backend_database_client: {{ .Values.appConfig.backend.database.client | quote | quote }} - APP_CONFIG_backend_database_connection_port: {{ include "backend.postgresql.port" . | quote }} - APP_CONFIG_backend_database_connection_host: {{ include "backend.postgresql.host" . | quote | quote }} - APP_CONFIG_backend_database_connection_user: {{ include "backend.postgresql.user" . | quote | quote }} - APP_CONFIG_backend_database_connection_database: {{ .Values.appConfig.backend.database.connection.database | quote | quote }} - APP_CONFIG_backend_database_connection_ssl_rejectUnauthorized: {{ .Values.appConfig.backend.database.connection.ssl.rejectUnauthorized | quote }} - APP_CONFIG_backend_database_connection_ssl_ca: {{ include "backstage.backend.postgresCaFilename" . | quote | quote }} - APP_CONFIG_sentry_organization: {{ .Values.appConfig.sentry.organization | quote | quote }} APP_CONFIG_techdocs_storageUrl: {{ .Values.appConfig.techdocs.storageUrl | quote | quote }} APP_CONFIG_techdocs_requestUrl: {{ .Values.appConfig.techdocs.requestUrl | quote | quote }} - APP_CONFIG_auth_providers_github_development_appOrigin: {{ .Values.appConfig.auth.providers.github.development.appOrigin | quote | quote }} - APP_CONFIG_auth_providers_google_development_appOrigin: {{ .Values.appConfig.auth.providers.google.development.appOrigin | quote | quote }} - APP_CONFIG_auth_providers_gitlab_development_appOrigin: {{ .Values.appConfig.auth.providers.gitlab.development.appOrigin | quote | quote }} - APP_CONFIG_auth_providers_okta_development_appOrigin: {{ .Values.appConfig.auth.providers.okta.development.appOrigin | quote | quote }} - APP_CONFIG_auth_providers_oauth2_development_appOrigin: {{ .Values.appConfig.auth.providers.oauth2.development.appOrigin | quote | quote }} APP_CONFIG_lighthouse_baseUrl: {{ .Values.appConfig.lighthouse.baseUrl | quote | quote }} diff --git a/contrib/chart/backstage/templates/backstage-auth-config.yaml b/contrib/chart/backstage/templates/backstage-auth-config.yaml deleted file mode 100644 index 5a2023bf3e..0000000000 --- a/contrib/chart/backstage/templates/backstage-auth-config.yaml +++ /dev/null @@ -1,19 +0,0 @@ -apiVersion: v1 -kind: ConfigMap -metadata: - name: {{ include "backstage.fullname" . }}-auth -data: - AUTH_GOOGLE_CLIENT_ID: {{ .Values.auth.google.clientId }} - AUTH_GITHUB_CLIENT_ID: {{ .Values.auth.github.clientId }} - AUTH_GITLAB_CLIENT_ID: {{ .Values.auth.gitlab.clientId }} - # This should not be prefixed with AUTH_. This could be a typo in the Backstage app config. - GITLAB_BASE_URL: {{ .Values.auth.gitlab.baseUrl }} - AUTH_OKTA_CLIENT_ID: {{ .Values.auth.okta.clientId }} - AUTH_OKTA_AUDIENCE: {{ .Values.auth.okta.audience }} - AUTH_OAUTH2_CLIENT_ID: {{ .Values.auth.oauth2.clientId }} - AUTH_OAUTH2_AUTH_URL: {{ .Values.auth.oauth2.authUrl }} - AUTH_OAUTH2_TOKEN_URL: {{ .Values.auth.oauth2.tokenUrl }} - AUTH_AUTH0_CLIENT_ID: {{ .Values.auth.auth0.clientId }} - AUTH_AUTH0_DOMAIN: {{ .Values.auth.auth0.domain }} - AUTH_MICROSOFT_CLIENT_ID: {{ .Values.auth.microsoft.clientId }} - AUTH_MICROSOFT_TENANT_ID: {{ .Values.auth.microsoft.tenantId }} diff --git a/contrib/chart/backstage/templates/frontend-deployment.yaml b/contrib/chart/backstage/templates/frontend-deployment.yaml index b494738758..a5d84be2b2 100644 --- a/contrib/chart/backstage/templates/frontend-deployment.yaml +++ b/contrib/chart/backstage/templates/frontend-deployment.yaml @@ -29,8 +29,16 @@ spec: resources: {{- toYaml .Values.backend.resources | nindent 12 }} envFrom: - - configMapRef: - name: {{ include "backstage.fullname" . }}-app + - configMapRef: + name: {{ include "backstage.fullname" . }}-app-env + volumeMounts: + - name: app-config + mountPath: {{ printf "/usr/share/nginx/html/static/%s" (include "backstage.appConfigFilename" .) }} + subPath: {{ include "backstage.appConfigFilename" . }} + volumes: + - name: app-config + configMap: + name: {{ include "backstage.fullname" . }}-app-config {{- if .Values.frontend.enabled }} --- apiVersion: v1 @@ -48,4 +56,4 @@ spec: component: frontend type: ClusterIP -{{- end }} \ No newline at end of file +{{- end }} diff --git a/contrib/chart/backstage/templates/lighthouse-deployment.yaml b/contrib/chart/backstage/templates/lighthouse-deployment.yaml index b727f5d242..25eccd10e6 100644 --- a/contrib/chart/backstage/templates/lighthouse-deployment.yaml +++ b/contrib/chart/backstage/templates/lighthouse-deployment.yaml @@ -33,6 +33,8 @@ spec: envFrom: - configMapRef: name: backstage-lighthouse + - configMapRef: + name: {{ include "backstage.fullname" . }}-app-env env: - name: LAS_PORT @@ -69,4 +71,4 @@ spec: component: lighthouse-audit-service type: ClusterIP -{{- end }} \ No newline at end of file +{{- end }}