From f858177780316e82b27a2e8c5db5435c2e21a94e Mon Sep 17 00:00:00 2001 From: Martina Iglesias Fernandez Date: Mon, 5 Oct 2020 17:29:25 +0200 Subject: [PATCH 01/24] feat: add basic Helm charts for deploying backstage --- contrib/chart/backstage/Chart.lock | 6 + contrib/chart/backstage/Chart.yaml | 30 ++ contrib/chart/backstage/README.md | 1 + .../backstage/files/create-backend-dbs.sql | 11 + .../chart/backstage/templates/_helpers.tpl | 279 ++++++++++++++++++ .../templates/backend-deployment.yaml | 71 +++++ .../backstage/templates/backend-secret.yaml | 20 ++ .../templates/backstage-app-config.yaml | 27 ++ .../templates/backstage-auth-config.yaml | 19 ++ .../templates/frontend-deployment.yaml | 51 ++++ .../chart/backstage/templates/ingress.yaml | 37 +++ .../templates/lighthouse-config.yaml | 10 + .../templates/lighthouse-deployment.yaml | 72 +++++ .../templates/postgresql-ca-config.yaml | 21 ++ .../templates/postgresql-certs-secret.yaml | 16 + .../templates/postgresql-initdb-secret.yaml | 14 + .../templates/postgresql-password-secret.yaml | 30 ++ .../templates/tests/test-app-connection.yaml | 23 ++ .../templates/tests/test-postgresql.yaml | 33 +++ contrib/chart/backstage/values.yaml | 240 +++++++++++++++ 20 files changed, 1011 insertions(+) create mode 100644 contrib/chart/backstage/Chart.lock create mode 100644 contrib/chart/backstage/Chart.yaml create mode 100644 contrib/chart/backstage/README.md create mode 100644 contrib/chart/backstage/files/create-backend-dbs.sql create mode 100644 contrib/chart/backstage/templates/_helpers.tpl create mode 100644 contrib/chart/backstage/templates/backend-deployment.yaml create mode 100644 contrib/chart/backstage/templates/backend-secret.yaml create mode 100644 contrib/chart/backstage/templates/backstage-app-config.yaml create mode 100644 contrib/chart/backstage/templates/backstage-auth-config.yaml create mode 100644 contrib/chart/backstage/templates/frontend-deployment.yaml create mode 100644 contrib/chart/backstage/templates/ingress.yaml create mode 100644 contrib/chart/backstage/templates/lighthouse-config.yaml create mode 100644 contrib/chart/backstage/templates/lighthouse-deployment.yaml create mode 100644 contrib/chart/backstage/templates/postgresql-ca-config.yaml create mode 100644 contrib/chart/backstage/templates/postgresql-certs-secret.yaml create mode 100644 contrib/chart/backstage/templates/postgresql-initdb-secret.yaml create mode 100644 contrib/chart/backstage/templates/postgresql-password-secret.yaml create mode 100644 contrib/chart/backstage/templates/tests/test-app-connection.yaml create mode 100644 contrib/chart/backstage/templates/tests/test-postgresql.yaml create mode 100644 contrib/chart/backstage/values.yaml diff --git a/contrib/chart/backstage/Chart.lock b/contrib/chart/backstage/Chart.lock new file mode 100644 index 0000000000..e390bf21ba --- /dev/null +++ b/contrib/chart/backstage/Chart.lock @@ -0,0 +1,6 @@ +dependencies: +- name: postgresql + repository: https://charts.bitnami.com/bitnami + version: 9.4.1 +digest: sha256:f949ec0fe7d146610ce2ee78fbfb4e52d235883a797968b0a1e61aa88ada2786 +generated: "2020-09-25T08:59:54.255582519+02:00" diff --git a/contrib/chart/backstage/Chart.yaml b/contrib/chart/backstage/Chart.yaml new file mode 100644 index 0000000000..92b5e3e309 --- /dev/null +++ b/contrib/chart/backstage/Chart.yaml @@ -0,0 +1,30 @@ +apiVersion: v2 +name: backstage +description: A Helm chart for Spotify Backstage +type: application + +# This is the chart version. This version number should be incremented each time you make changes +# to the chart and its templates, including the app version. +version: 0.1.0 + +# This is the version number of the application being deployed. This version number should be +# incremented each time you make changes to the application. +appVersion: v0.1.1-alpha.23 + +sources: + - https://github.com/spotify/backstage + - https://github.com/spotify/lighthouse-audit-service + +dependencies: + - name: postgresql + condition: postgresql.enabled + version: 9.4.1 + repository: https://charts.bitnami.com/bitnami + +maintainers: + - name: Martina Iglesias Fernandez + email: martina@roadie.io + url: https://roadie.io + - name: David Tuite + email: david@roadie.io + url: https://roadie.io diff --git a/contrib/chart/backstage/README.md b/contrib/chart/backstage/README.md new file mode 100644 index 0000000000..bb2ff84411 --- /dev/null +++ b/contrib/chart/backstage/README.md @@ -0,0 +1 @@ +# TO DO diff --git a/contrib/chart/backstage/files/create-backend-dbs.sql b/contrib/chart/backstage/files/create-backend-dbs.sql new file mode 100644 index 0000000000..e8124dbd22 --- /dev/null +++ b/contrib/chart/backstage/files/create-backend-dbs.sql @@ -0,0 +1,11 @@ +{{ $backendDb := .Values.appConfig.backend.database.connection.database }} +{{ $lighthouseDb := .Values.lighthouse.database.connection.database }} +{{ $user := .Values.global.postgresql.postgresqlUsername }} + +create database {{ $backendDb }}; +grant all privileges on database {{ $backendDb }} to {{ $user }}; + +{{ if not (eq $backendDb $lighthouseDb) }} +create database {{ $lighthouseDb }}; +grant all privileges on database {{ $lighthouseDb }} to {{ $user }}; +{{ end }} \ No newline at end of file diff --git a/contrib/chart/backstage/templates/_helpers.tpl b/contrib/chart/backstage/templates/_helpers.tpl new file mode 100644 index 0000000000..9f3b1cfbdc --- /dev/null +++ b/contrib/chart/backstage/templates/_helpers.tpl @@ -0,0 +1,279 @@ +{{/* +Expand the name of the chart. +*/}} +{{- define "backstage.name" -}} +{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}} +{{- end -}} + +{{/* +Create a default fully qualified app name. +We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). +If release name contains chart name it will be used as a full name. +*/}} +{{- define "backstage.fullname" -}} +{{- if .Values.fullnameOverride -}} +{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" -}} +{{- else -}} +{{- $name := default .Chart.Name .Values.nameOverride -}} +{{- if contains $name .Release.Name -}} +{{- .Release.Name | trunc 63 | trimSuffix "-" -}} +{{- else -}} +{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}} +{{- end -}} +{{- end -}} +{{- end -}} + +{{/* +Create chart name and version as used by the chart label. +*/}} +{{- define "backstage.chart" -}} +{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}} +{{- end -}} + +{{/* +Common App labels +*/}} +{{- define "backstage.app.labels" -}} +app.kubernetes.io/name: {{ include "backstage.name" . }}-app +helm.sh/chart: {{ include "backstage.chart" . }} +app.kubernetes.io/instance: {{ .Release.Name }} +{{- if .Chart.AppVersion }} +app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} +{{- end }} +app.kubernetes.io/managed-by: {{ .Release.Service }} +{{- end -}} + +{{/* +Common Backend labels +*/}} +{{- define "backstage.backend.labels" -}} +app.kubernetes.io/name: {{ include "backstage.name" . }}-backend +helm.sh/chart: {{ include "backstage.chart" . }} +app.kubernetes.io/instance: {{ .Release.Name }} +{{- if .Chart.AppVersion }} +app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} +{{- end }} +app.kubernetes.io/managed-by: {{ .Release.Service }} +{{- end -}} + +{{/* +Name for postgresql dependency +See https://github.com/helm/helm/issues/3920#issuecomment-686913512 +*/}} +{{- define "backstage.postgresql.fullname" -}} +{{ printf "%s-%s" .Release.Name .Values.postgresql.nameOverride }} +{{- end -}} + + +{{/* +Create the name of the service account to use for the app +*/}} +{{- define "backstage.app.serviceAccountName" -}} +{{- if .Values.app.serviceAccount.create -}} + {{ default "default" .Values.app.serviceAccount.name }} +{{- else -}} + {{ default "default" .Values.app.serviceAccount.name }} +{{- end -}} +{{- end -}} + +{{/* +Create the name of the service account to use for the backend +*/}} +{{- define "backstage.backend.serviceAccountName" -}} +{{- if .Values.backend.serviceAccount.create -}} + {{ default default .Values.backend.serviceAccount.name }} +{{- else -}} + {{ default "default" .Values.backend.serviceAccount.name }} +{{- end -}} +{{- end -}} + +{{/* +Path to the CA certificate file in the backend +*/}} +{{- define "backstage.backend.postgresCaFilename" -}} +{{ include "backstage.backend.postgresCaDir" . }}/{{- required "The name for the CA certificate file for postgresql is required" .Values.global.postgresql.caFilename }} +{{- end -}} +{{/* + +{{/* +Directory path to the CA certificate file in the backend +*/}} +{{- define "backstage.backend.postgresCaDir" -}} +{{- if .Values.appConfig.backend.database.connection.ssl.ca -}} + {{ .Values.appConfig.backend.database.connection.ssl.ca }} +{{- else -}} +/etc/postgresql +{{- end -}} +{{- end -}} +{{/* + +Path to the CA certificate file in lighthouse +*/}} +{{- define "backstage.lighthouse.postgresCaFilename" -}} +{{ include "backstage.lighthouse.postgresCaDir" . }}/{{- required "The name for the CA certificate file for postgresql is required" .Values.global.postgresql.caFilename }} +{{- end -}} + +{{/* +Directory path to the CA certificate file in lighthouse +*/}} +{{- define "backstage.lighthouse.postgresCaDir" -}} +{{- if .Values.lighthouse.database.pathToDatabaseCa -}} + {{ .Values.lighthouse.database.pathToDatabaseCa }} +{{- else -}} +/etc/postgresql +{{- end -}} +{{- end -}} +{{/* + +{{/* +Generate ca for postgresql +*/}} +{{- define "backstage.postgresql.generateCA" -}} +{{- $ca := .ca | default (genCA (include "backstage.postgresql.fullname" .) 365) -}} +{{- $_ := set . "ca" $ca -}} +{{- $ca.Cert -}} +{{- end -}} + +{{/* +Generate certificates for postgresql +*/}} +{{- define "generateCerts" -}} +{{- $postgresName := (include "backstage.postgresql.fullname" .) }} +{{- $altNames := list $postgresName ( printf "%s.%s" $postgresName .Release.Namespace ) ( printf "%s.%s.svc" ( $postgresName ) .Release.Namespace ) -}} +{{- $ca := .ca | default (genCA (include "backstage.postgresql.fullname" .) 365) -}} +{{- $_ := set . "ca" $ca -}} +{{- $cert := genSignedCert ( $postgresName ) nil $altNames 365 $ca -}} +tls.crt: {{ $cert.Cert | b64enc }} +tls.key: {{ $cert.Key | b64enc }} +{{- end -}} + +{{/* +Generate a password for the postgres user used for the connections from the backend and lighthouse +*/}} +{{- define "postgresql.generateUserPassword" -}} +{{- $pgPassword := .pgPassword | default ( randAlphaNum 12 ) -}} +{{- $_ := set . "pgPassword" $pgPassword -}} +{{ $pgPassword}} +{{- end -}} + +{{/* +Name of the backend service +*/}} +{{- define "backend.serviceName" -}} +{{ include "backstage.fullname" . }}-backend +{{- end -}} + +{{/* +Name of the frontend service +*/}} +{{- define "frontend.serviceName" -}} +{{ include "backstage.fullname" . }}-frontend +{{- end -}} + +{{/* +Name of the lighthouse backend service +*/}} +{{- define "lighthouse.serviceName" -}} +{{ include "backstage.fullname" . }}-lighthouse +{{- end -}} + +{{/* +Name of the postgresql service +*/}} +{{- define "postgresql.serviceName" -}} +{{- include "backstage.postgresql.fullname" . }} +{{- end -}} + +{{/* +Postgres host for lighthouse +*/}} +{{- define "lighthouse.postgresql.host" -}} +{{- if .Values.postgresql.enabled }} +{{- include "postgresql.serviceName" . }} +{{- else -}} +{{- required "A valid .Values.lighthouse.database.connection.host is required when postgresql is not enabled" .Values.lighthouse.database.connection.host -}} +{{- end -}} +{{- end -}} + +{{/* +Postgres host for the backend +*/}} +{{- define "backend.postgresql.host" -}} +{{- if .Values.postgresql.enabled }} +{{- include "postgresql.serviceName" . }} +{{- else -}} +{{- required "A valid .Values.appConfig.backend.database.connection.host is required when postgresql is not enabled" .Values.appConfig.backend.database.connection.host -}} +{{- end -}} +{{- end -}} + +{{/* +Postgres port for the backend +*/}} +{{- define "backend.postgresql.port" -}} +{{- if .Values.postgresql.enabled }} +{{- .Values.postgresql.service.port }} +{{- else if .Values.appConfig.backend.database.connection.port -}} +{{- .Values.appConfig.backend.database.connection.port }} +{{ else }} +5432 +{{- end -}} +{{- end -}} + +{{/* +Postgres port for lighthouse +*/}} +{{- define "lighthouse.postgresql.port" -}} +{{- if .Values.postgresql.enabled }} +{{- .Values.postgresql.service.port }} +{{- else if .Values.lighthouse.database.connection.port -}} +{{- .Values.lighthouse.database.connection.port }} +{{- else -}} +5432 +{{- end -}} +{{- end -}} + +{{/* +Postgres user for backend +*/}} +{{- define "backend.postgresql.user" -}} +{{- if .Values.postgresql.enabled }} +{{- .Values.global.postgresql.postgresqlUsername }} +{{- else -}} +{{- required "A valid .Values.appConfig.backend.database.connection.user is required when postgresql is not enabled" .Values.appConfig.backend.database.connection.user -}} +{{- end -}} +{{- end -}} + +{{/* +Postgres user for lighthouse +*/}} +{{- define "lighthouse.postgresql.user" -}} +{{- if .Values.postgresql.enabled }} +{{- .Values.global.postgresql.postgresqlUsername }} +{{- else -}} +{{- required "A valid .Values.lighthouse.database.connection.user is required when postgresql is not enabled" .Values.lighthouse.database.connection.user -}} +{{- end -}} +{{- end -}} + +{{/* +Postgres password secret for backend +*/}} +{{- define "backend.postgresql.passwordSecret" -}} +{{- if .Values.postgresql.enabled }} +{{- template "backstage.postgresql.fullname" . }} +{{- else -}} +{{ $secretName := (printf "%s-backend-postgres" (include "backstage.fullname" . )) }} +{{- required "A valid .Values.appConfig.backend.database.connection.password is required when postgresql is not enabled" $secretName -}} +{{- end -}} +{{- end -}} + +{{/* +Postgres password for lighthouse +*/}} +{{- define "lighthouse.postgresql.passwordSecret" -}} +{{- if .Values.postgresql.enabled }} +{{- template "backstage.postgresql.fullname" . }} +{{- else -}} +{{ $secretName := (printf "%s-lighthouse-postgres" (include "backstage.fullname" . )) }} +{{- required "A valid .Values.lighthouse.database.connection.password is required when postgresql is not enabled" $secretName -}} +{{- end -}} +{{- end -}} diff --git a/contrib/chart/backstage/templates/backend-deployment.yaml b/contrib/chart/backstage/templates/backend-deployment.yaml new file mode 100644 index 0000000000..67177d7923 --- /dev/null +++ b/contrib/chart/backstage/templates/backend-deployment.yaml @@ -0,0 +1,71 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: {{ include "backstage.fullname" . }}-backend + +spec: + replicas: {{ .Values.backend.replicaCount }} + + selector: + matchLabels: + app: backstage + component: backend + + template: + metadata: + annotations: + ad.datadoghq.com/backstage.logs: '[{"source":"backstage","service":"backend"}]' + labels: + app: backstage + component: backend + + spec: + containers: + - name: {{ .Chart.Name }}-backend + image: {{ .Values.backend.image.repository }}:{{ .Values.backend.image.tag }} + imagePullPolicy: {{ .Values.backend.image.pullPolicy }} + ports: + - containerPort: {{ .Values.backend.containerPort }} + resources: + {{- 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 + env: + - name: APP_CONFIG_backend_postgresPassword + valueFrom: + secretKeyRef: + name: {{ include "backend.postgresql.passwordSecret" .}} + key: postgresql-password + volumeMounts: + - name: postgres-ca + mountPath: {{ include "backstage.backend.postgresCaDir" . }} + + volumes: + - name: postgres-ca + configMap: + name: {{ include "backstage.fullname" . }}-postgres-ca + +{{- if .Values.backend.enabled }} +--- +apiVersion: v1 +kind: Service +metadata: + name: {{ include "backend.serviceName" . }} + +spec: + ports: + - port: 80 + targetPort: {{ .Values.backend.containerPort }} + + selector: + app: backstage + component: backend + + type: ClusterIP +{{- end }} \ No newline at end of file diff --git a/contrib/chart/backstage/templates/backend-secret.yaml b/contrib/chart/backstage/templates/backend-secret.yaml new file mode 100644 index 0000000000..3acb220d81 --- /dev/null +++ b/contrib/chart/backstage/templates/backend-secret.yaml @@ -0,0 +1,20 @@ +{{- if .Values.backend.enabled }} +apiVersion: v1 +kind: Secret +metadata: + name: {{ include "backstage.fullname" . }}-backend +type: Opaque +stringData: + AUTH_GOOGLE_CLIENT_SECRET: {{ .Values.auth.google.clientSecret }} + AUTH_GITHUB_CLIENT_SECRET: {{ .Values.auth.github.clientSecret }} + AUTH_GITLAB_CLIENT_SECRET: {{ .Values.auth.gitlab.clientSecret }} + AUTH_OKTA_CLIENT_SECRET: {{ .Values.auth.okta.clientSecret }} + AUTH_OAUTH2_CLIENT_SECRET: {{ .Values.auth.oauth2.clientSecret }} + AUTH_AUTH0_CLIENT_SECRET: {{ .Values.auth.auth0.clientSecret }} + AUTH_MICROSOFT_CLIENT_SECRET: {{ .Values.auth.microsoft.clientSecret }} + SENTRY_TOKEN: {{ .Values.auth.sentryToken }} + ROLLBAR_ACCOUNT_TOKEN: {{ .Values.auth.rollbarAccountToken }} + CIRCLECI_AUTH_TOKEN: {{ .Values.auth.circleciAuthToken }} + GITHUB_ACCESS_TOKEN: {{ .Values.auth.githubAccessToken }} + GITLAB_ACCESS_TOKEN: {{ .Values.auth.gitlabAccessToken }} +{{- end }} diff --git a/contrib/chart/backstage/templates/backstage-app-config.yaml b/contrib/chart/backstage/templates/backstage-app-config.yaml new file mode 100644 index 0000000000..be937cee13 --- /dev/null +++ b/contrib/chart/backstage/templates/backstage-app-config.yaml @@ -0,0 +1,27 @@ +apiVersion: v1 +kind: ConfigMap +metadata: + name: {{ include "backstage.fullname" . }}-app +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 new file mode 100644 index 0000000000..5a2023bf3e --- /dev/null +++ b/contrib/chart/backstage/templates/backstage-auth-config.yaml @@ -0,0 +1,19 @@ +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 new file mode 100644 index 0000000000..b494738758 --- /dev/null +++ b/contrib/chart/backstage/templates/frontend-deployment.yaml @@ -0,0 +1,51 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: {{ include "backstage.fullname" . }}-frontend + +spec: + replicas: {{ .Values.frontend.replicaCount }} + + selector: + matchLabels: + app: backstage + component: frontend + + template: + metadata: + annotations: + ad.datadoghq.com/backstage.logs: '[{"source":"backstage","service":"frontend"}]' + labels: + app: backstage + component: frontend + + spec: + containers: + - name: {{ .Chart.Name }}-frontend + image: {{ .Values.frontend.image.repository }}:{{ .Values.frontend.image.tag }} + imagePullPolicy: {{ .Values.frontend.image.pullPolicy }} + ports: + - containerPort: {{ .Values.frontend.containerPort }} + resources: + {{- toYaml .Values.backend.resources | nindent 12 }} + envFrom: + - configMapRef: + name: {{ include "backstage.fullname" . }}-app +{{- if .Values.frontend.enabled }} +--- +apiVersion: v1 +kind: Service +metadata: + name: {{ include "frontend.serviceName" . }} + +spec: + ports: + - port: 80 + targetPort: {{ .Values.frontend.containerPort }} + + selector: + app: backstage + component: frontend + + type: ClusterIP +{{- end }} \ No newline at end of file diff --git a/contrib/chart/backstage/templates/ingress.yaml b/contrib/chart/backstage/templates/ingress.yaml new file mode 100644 index 0000000000..6996bb5d8d --- /dev/null +++ b/contrib/chart/backstage/templates/ingress.yaml @@ -0,0 +1,37 @@ +apiVersion: networking.k8s.io/v1beta1 +kind: Ingress +metadata: + name: {{ include "backstage.fullname" . }}-ingress-backend + {{- with .Values.ingress.annotations }} + annotations: + nginx.ingress.kubernetes.io/rewrite-target: /$2 + {{- toYaml . | nindent 4 }} + {{- end }} +spec: + rules: + - http: + paths: + - backend: + serviceName: {{ include "backend.serviceName" . }} + servicePort: 80 + path: /api(/|$)(.*) +--- +# Having rewrite rules in an ingress with a '/' path results in an error when loading the +# site "Unexpected token: <". That's why we need two ingress resources +# See https://stackoverflow.com/questions/59931177/gke-install-nginx-ingress-with-static-ip-and-fanout +apiVersion: networking.k8s.io/v1beta1 +kind: Ingress +metadata: + name: {{ include "backstage.fullname" . }}-ingress-frontend + {{- with .Values.ingress.annotations }} + annotations: + {{- toYaml . | nindent 4 }} + {{- end }} +spec: + rules: + - http: + paths: + - backend: + serviceName: {{ include "frontend.serviceName" . }} + servicePort: 80 + path: / diff --git a/contrib/chart/backstage/templates/lighthouse-config.yaml b/contrib/chart/backstage/templates/lighthouse-config.yaml new file mode 100644 index 0000000000..fdf4bd8b06 --- /dev/null +++ b/contrib/chart/backstage/templates/lighthouse-config.yaml @@ -0,0 +1,10 @@ +apiVersion: v1 +kind: ConfigMap +metadata: + name: {{ include "backstage.fullname" . -}}-lighthouse +data: + PGDATABASE: {{ .Values.lighthouse.database.connection.database | quote }} + PGUSER: {{ include "lighthouse.postgresql.user" . | quote }} + PGPORT: {{ include "lighthouse.postgresql.port" . | quote }} + PGHOST: {{ include "lighthouse.postgresql.host" . | quote }} + PGPATH_TO_CA: {{ include "backstage.lighthouse.postgresCaFilename" . | quote }} \ No newline at end of file diff --git a/contrib/chart/backstage/templates/lighthouse-deployment.yaml b/contrib/chart/backstage/templates/lighthouse-deployment.yaml new file mode 100644 index 0000000000..b727f5d242 --- /dev/null +++ b/contrib/chart/backstage/templates/lighthouse-deployment.yaml @@ -0,0 +1,72 @@ +{{- if .Values.lighthouse.enabled }} +apiVersion: apps/v1 +kind: Deployment +metadata: + name: {{ include "backstage.fullname" . }}-lighthouse + +spec: + replicas: {{ .Values.lighthouse.replicaCount }} + + selector: + matchLabels: + app: backstage + component: lighthouse-audit-service + + template: + metadata: + annotations: + ad.datadoghq.com/backstage.logs: '[{"source":"backstage","service":"lighthouse"}]' + labels: + app: backstage + component: lighthouse-audit-service + + spec: + containers: + - name: lighthouse-audit-service + image: {{ .Values.lighthouse.image.repository }}:{{ .Values.lighthouse.image.tag }} + imagePullPolicy: {{ .Values.lighthouse.image.pullPolicy }} + ports: + - containerPort: {{ .Values.lighthouse.containerPort }} + resources: + {{- toYaml .Values.lighthouse.resources | nindent 12 }} + + envFrom: + - configMapRef: + name: backstage-lighthouse + + env: + - name: LAS_PORT + value: {{ .Values.lighthouse.containerPort | quote }} + - name: LAS_CORS + value: "true" + - name: PGPASSWORD + valueFrom: + secretKeyRef: + name: {{ include "lighthouse.postgresql.passwordSecret" . }} + key: postgresql-password + + volumeMounts: + - name: postgres-ca + mountPath: {{ include "backstage.lighthouse.postgresCaDir" . }} + + volumes: + - name: postgres-ca + configMap: + name: {{ include "backstage.fullname" . }}-postgres-ca +--- +apiVersion: v1 +kind: Service +metadata: + name: {{ include "lighthouse.serviceName" . }} + +spec: + ports: + - port: 80 + targetPort: {{ .Values.lighthouse.containerPort }} + + selector: + app: backstage + component: lighthouse-audit-service + + type: ClusterIP +{{- end }} \ No newline at end of file diff --git a/contrib/chart/backstage/templates/postgresql-ca-config.yaml b/contrib/chart/backstage/templates/postgresql-ca-config.yaml new file mode 100644 index 0000000000..2631989f4e --- /dev/null +++ b/contrib/chart/backstage/templates/postgresql-ca-config.yaml @@ -0,0 +1,21 @@ +{{- if .Values.postgresql.enabled }} +--- +apiVersion: v1 +kind: ConfigMap +metadata: + name: {{ include "backstage.fullname" . }}-postgres-ca + labels: + app: {{ include "backstage.postgresql.fullname" . }} + release: {{ .Release.Name }} + annotations: + "helm.sh/hook": "pre-install" + "helm.sh/hook-delete-policy": "before-hook-creation" +data: + {{ .Values.global.postgresql.caFilename }}: | +{{ include "backstage.postgresql.generateCA" . | indent 4}} +{{- else }} +{{- $caConfig := printf "%s-postgres-ca" (include "backstage.fullname" .) }} +{{- if not ( lookup "v1" "ConfigMap" .Release.Namespace $caConfig ) }} +{{- fail (printf "\n\nPlease create the '%s' configmap with the CA certificate for your existing postgresql: kubectl create configmap %s --from-file=ca.crt" $caConfig $caConfig) }} +{{- end }} +{{- end }} \ No newline at end of file diff --git a/contrib/chart/backstage/templates/postgresql-certs-secret.yaml b/contrib/chart/backstage/templates/postgresql-certs-secret.yaml new file mode 100644 index 0000000000..c6845caa7e --- /dev/null +++ b/contrib/chart/backstage/templates/postgresql-certs-secret.yaml @@ -0,0 +1,16 @@ +{{- if .Values.postgresql.enabled }} +--- +apiVersion: v1 +kind: Secret +type: kubernetes.io/tls +metadata: + name: {{ required ".Values.postgresql.tls.certificatesSecret is required" .Values.postgresql.tls.certificatesSecret }} + labels: + app: {{ include "backstage.postgresql.fullname" . }} + release: {{ .Release.Name }} + annotations: + "helm.sh/hook": "pre-install" + "helm.sh/hook-delete-policy": "before-hook-creation" +data: +{{ include "generateCerts" . | indent 2 }} +{{- end }} diff --git a/contrib/chart/backstage/templates/postgresql-initdb-secret.yaml b/contrib/chart/backstage/templates/postgresql-initdb-secret.yaml new file mode 100644 index 0000000000..d1c446f79f --- /dev/null +++ b/contrib/chart/backstage/templates/postgresql-initdb-secret.yaml @@ -0,0 +1,14 @@ +{{- if .Values.postgresql.enabled }} +apiVersion: v1 +kind: Secret +metadata: + name: {{ required ".Values.postgresql.initdbScriptsSecret is required" .Values.postgresql.initdbScriptsSecret }} + annotations: + "helm.sh/hook": "pre-install" + "helm.sh/hook-delete-policy": "before-hook-creation" +type: Opaque +data: + create-backend-dbs.sql: | + {{ tpl (.Files.Get "files/create-backend-dbs.sql") . | b64enc }} +{{- end }} + diff --git a/contrib/chart/backstage/templates/postgresql-password-secret.yaml b/contrib/chart/backstage/templates/postgresql-password-secret.yaml new file mode 100644 index 0000000000..7e72888607 --- /dev/null +++ b/contrib/chart/backstage/templates/postgresql-password-secret.yaml @@ -0,0 +1,30 @@ +{{- if not .Values.postgresql.enabled }} +--- +apiVersion: v1 +kind: Secret +type: Opaque +metadata: + name: {{ include "backend.postgresql.passwordSecret" . }} + labels: + release: {{ .Release.Name }} + annotations: + "helm.sh/hook": "pre-install" + "helm.sh/hook-delete-policy": "before-hook-creation" +data: + postgresql-password: {{ .Values.appConfig.backend.database.connection.password }} +{{- end }} +{{- if not .Values.postgresql.enabled }} +--- +apiVersion: v1 +kind: Secret +type: Opaque +metadata: + name: {{ include "lighthouse.postgresql.passwordSecret" . }} + labels: + release: {{ .Release.Name }} + annotations: + "helm.sh/hook": "pre-install" + "helm.sh/hook-delete-policy": "before-hook-creation" +data: + postgresql-password: {{ .Values.lighthouse.database.connection.password }} +{{- end }} \ No newline at end of file diff --git a/contrib/chart/backstage/templates/tests/test-app-connection.yaml b/contrib/chart/backstage/templates/tests/test-app-connection.yaml new file mode 100644 index 0000000000..93f51f3f09 --- /dev/null +++ b/contrib/chart/backstage/templates/tests/test-app-connection.yaml @@ -0,0 +1,23 @@ +--- +apiVersion: v1 +kind: Pod +metadata: + name: {{ include "backstage.fullname" . -}}-test-app-connection + annotations: + "helm.sh/hook": test +spec: + containers: + - name: test-app + image: busybox + command: + - /bin/sh + - -ecx + - | + echo -e "===== Testing the connection with the frontend...\n" + wget -q -O - {{ printf "%s.%s" (include "frontend.serviceName" .) .Release.Namespace | quote }} + echo -e "\n\n===== Testing the connection with the backend...\n" + wget -q -O - {{ printf "http://%s.%s/catalog/entities" (include "backend.serviceName" .) .Release.Namespace | quote }} + echo -e "\n\n===== Testing the connection with the lighthouse plugin...\n" + wget -q -O - {{ printf "%s.%s/v1/audits" (include "lighthouse.serviceName" .) .Release.Namespace | quote }} + echo -e "\n" + restartPolicy: Never \ No newline at end of file diff --git a/contrib/chart/backstage/templates/tests/test-postgresql.yaml b/contrib/chart/backstage/templates/tests/test-postgresql.yaml new file mode 100644 index 0000000000..8eec1db452 --- /dev/null +++ b/contrib/chart/backstage/templates/tests/test-postgresql.yaml @@ -0,0 +1,33 @@ +{{- if .Values.postgresql.enabled}} +--- +apiVersion: v1 +kind: Pod +metadata: + name: {{ include "backstage.name" . -}}-test-postgres + annotations: + "helm.sh/hook": test +spec: + containers: + - name: postgresql-client + image: bitnami/postgresql + env: + - name: PG_HOST + value: {{ include "postgresql.serviceName" . | quote }} + - name: PG_PORT + value: {{ .Values.postgresql.service.port | quote }} + - name: PG_USER + value: {{ .Values.global.postgresql.postgresqlUsername | quote }} + - name: PGPASSWORD + valueFrom: + secretKeyRef: + name: {{ include "backend.postgresql.passwordSecret" .}} + key: postgresql-password + - name: PG_DBNAME + value: {{ .Values.appConfig.backend.database.connection.database }} + command: + - /bin/bash + - -ecx + - | + psql --host=$PG_HOST --port=$PG_PORT --username=$PG_USER --dbname=$PG_DBNAME --no-password + restartPolicy: Never +{{- end }} \ No newline at end of file diff --git a/contrib/chart/backstage/values.yaml b/contrib/chart/backstage/values.yaml new file mode 100644 index 0000000000..5e22b9ac8a --- /dev/null +++ b/contrib/chart/backstage/values.yaml @@ -0,0 +1,240 @@ +# Default values for backstage. +# This is a YAML-formatted file. +# Declare variables to be passed into your templates. + +frontend: + enabled: true + replicaCount: 1 + image: + repository: roadiehq/backstage-k8s-demo-frontend + tag: latest + pullPolicy: IfNotPresent + containerPort: 80 + resources: + requests: + memory: 128Mi + limits: + memory: 256Mi + +backend: + enabled: true + replicaCount: 1 + image: + repository: roadiehq/backstage-k8s-demo-backend + tag: latest + pullPolicy: IfNotPresent + containerPort: 7000 + resources: + requests: + memory: 512Mi + limits: + memory: 1024Mi + +lighthouse: + enabled: true + replicaCount: 1 + image: + repository: roadiehq/lighthouse-audit-service + tag: latest + pullPolicy: IfNotPresent + containerPort: 3003 + resources: + requests: + memory: 128Mi + limits: + memory: 256Mi + database: + connection: + port: + host: + user: + password: + database: lighthouse_audit_service + pathToDatabaseCa: + +nameOverride: "" +fullnameOverride: "" + +ingress: + annotations: + kubernetes.io/ingress.class: nginx + +global: + postgresql: + postgresqlUsername: backend-user + caFilename: ca.crt + +postgresql: + enabled: true + nameOverride: postgresql + tls: + enabled: true + certificatesSecret: backstage-postgresql-certs + certFilename: tls.crt + certKeyFilename: tls.key + volumePermissions: + enabled: true + initdbScriptsSecret: backstage-postgresql-initdb + +appConfig: + app: + baseUrl: https://demo.example.com + title: Backstage + backend: + baseUrl: /api + listen: 0.0.0.0:7000 + cors: + origin: https://demo.example.com + database: + client: pg + connection: + database: backend + host: + user: + port: + password: + ssl: + rejectUnauthorized: false + ca: + sentry: + organization: spotify + techdocs: + storageUrl: https://backend.example.com/techdocs/static/docs + requestUrl: https://backend.example.com/techdocs/docs + lighthouse: + baseUrl: https://lighthouse.example.com + rollbar: + organization: roadie + + # Auth config has recently moved into the app config file in upstream Backstage. However, + # most of this config simply mandates that items like the client id and client secret should + # be picked up from the environment variables named below. Those environment variables are + # set in this helm controlled environment by the 'auth' configuration below this section. + # Thus, the only key in this config which directly controls an app config is the + # auth.providers.github.development.appOrigin property. + auth: + providers: + google: + development: + appOrigin: "http://localhost:3000/" + secure: false + clientId: + $secret: + env: AUTH_GOOGLE_CLIENT_ID + clientSecret: + $secret: + env: AUTH_GOOGLE_CLIENT_SECRET + github: + development: + appOrigin: "http://localhost:3000/" + secure: false + clientId: + $secret: + env: AUTH_GITHUB_CLIENT_ID + clientSecret: + $secret: + env: AUTH_GITHUB_CLIENT_SECRET + enterpriseInstanceUrl: + $secret: + env: AUTH_GITHUB_ENTERPRISE_INSTANCE_URL + gitlab: + development: + appOrigin: "http://localhost:3000/" + secure: false + clientId: + $secret: + env: AUTH_GITLAB_CLIENT_ID + clientSecret: + $secret: + env: AUTH_GITLAB_CLIENT_SECRET + audience: + $secret: + env: GITLAB_BASE_URL + okta: + development: + appOrigin: "http://localhost:3000/" + secure: false + clientId: + $secret: + env: AUTH_OKTA_CLIENT_ID + clientSecret: + $secret: + env: AUTH_OKTA_CLIENT_SECRET + audience: + $secret: + env: AUTH_OKTA_AUDIENCE + oauth2: + development: + appOrigin: "http://localhost:3000/" + secure: false + clientId: + $secret: + env: AUTH_OAUTH2_CLIENT_ID + clientSecret: + $secret: + env: AUTH_OAUTH2_CLIENT_SECRET + authorizationURL: + $secret: + env: AUTH_OAUTH2_AUTH_URL + tokenURL: + $secret: + env: AUTH_OAUTH2_TOKEN_URL + auth0: + development: + clientId: + $secret: + env: AUTH_AUTH0_CLIENT_ID + clientSecret: + $secret: + env: AUTH_AUTH0_CLIENT_SECRET + domain: + $secret: + env: AUTH_AUTH0_DOMAIN + microsoft: + development: + clientId: + $secret: + env: AUTH_MICROSOFT_CLIENT_ID + clientSecret: + $secret: + env: AUTH_MICROSOFT_CLIENT_SECRET + tenantId: + $secret: + env: AUTH_MICROSOFT_TENANT_ID + +auth: + google: + clientId: a + clientSecret: a + github: + clientId: c + clientSecret: c + gitlab: + clientId: b + clientSecret: b + baseUrl: b + okta: + clientId: b + clientSecret: b + audience: b + oauth2: + clientId: b + clientSecret: b + authUrl: b + tokenUrl: b + auth0: + clientId: b + clientSecret: b + domain: b + microsoft: + clientId: f + clientSecret: f + tenantId: f + sentryToken: e + rollbarAccountToken: f + # This is a 'Personal Access Token' + circleciAuthToken: r + # Used by the scaffolder to create GitHub repos. Must have 'repo' scope. + githubAccessToken: g + gitlabAccessToken: g + From 04057888d16f831464fea1f6df7fa25a3cc17b63 Mon Sep 17 00:00:00 2001 From: Martina Iglesias Fernandez Date: Mon, 5 Oct 2020 17:29:26 +0200 Subject: [PATCH 02/24] Fix prettier error in values.yaml --- contrib/chart/backstage/values.yaml | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/contrib/chart/backstage/values.yaml b/contrib/chart/backstage/values.yaml index 5e22b9ac8a..64cf5e91be 100644 --- a/contrib/chart/backstage/values.yaml +++ b/contrib/chart/backstage/values.yaml @@ -52,8 +52,8 @@ lighthouse: database: lighthouse_audit_service pathToDatabaseCa: -nameOverride: "" -fullnameOverride: "" +nameOverride: '' +fullnameOverride: '' ingress: annotations: @@ -116,7 +116,7 @@ appConfig: providers: google: development: - appOrigin: "http://localhost:3000/" + appOrigin: 'http://localhost:3000/' secure: false clientId: $secret: @@ -126,7 +126,7 @@ appConfig: env: AUTH_GOOGLE_CLIENT_SECRET github: development: - appOrigin: "http://localhost:3000/" + appOrigin: 'http://localhost:3000/' secure: false clientId: $secret: @@ -134,12 +134,12 @@ appConfig: clientSecret: $secret: env: AUTH_GITHUB_CLIENT_SECRET - enterpriseInstanceUrl: + enterpriseInstanceUrl: $secret: env: AUTH_GITHUB_ENTERPRISE_INSTANCE_URL gitlab: development: - appOrigin: "http://localhost:3000/" + appOrigin: 'http://localhost:3000/' secure: false clientId: $secret: @@ -152,7 +152,7 @@ appConfig: env: GITLAB_BASE_URL okta: development: - appOrigin: "http://localhost:3000/" + appOrigin: 'http://localhost:3000/' secure: false clientId: $secret: @@ -165,7 +165,7 @@ appConfig: env: AUTH_OKTA_AUDIENCE oauth2: development: - appOrigin: "http://localhost:3000/" + appOrigin: 'http://localhost:3000/' secure: false clientId: $secret: @@ -237,4 +237,3 @@ auth: # Used by the scaffolder to create GitHub repos. Must have 'repo' scope. githubAccessToken: g gitlabAccessToken: g - From 14fa4bc899b924a71be6d8da2f17df99007f4ef6 Mon Sep 17 00:00:00 2001 From: Martina Iglesias Fernandez Date: Mon, 5 Oct 2020 17:29:27 +0200 Subject: [PATCH 03/24] Add app-config.local.yaml and demo data --- .../backstage/files/app-config.local.yaml.tpl | 72 +++++++++++++++++++ .../chart/backstage/templates/_helpers.tpl | 7 ++ .../templates/backend-deployment.yaml | 14 ++-- .../templates/backstage-app-config.yaml | 26 +++---- .../templates/backstage-auth-config.yaml | 19 ----- .../templates/frontend-deployment.yaml | 14 +++- .../templates/lighthouse-deployment.yaml | 4 +- 7 files changed, 111 insertions(+), 45 deletions(-) create mode 100644 contrib/chart/backstage/files/app-config.local.yaml.tpl delete mode 100644 contrib/chart/backstage/templates/backstage-auth-config.yaml 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 }} From 8d578eed59eb7df344a684ef252682977cd40260 Mon Sep 17 00:00:00 2001 From: Martina Iglesias Fernandez Date: Mon, 5 Oct 2020 17:29:27 +0200 Subject: [PATCH 04/24] Update docker images to latest master changes --- .../backstage/files/app-config.local.yaml.tpl | 39 +++---------------- .../backstage/files/create-backend-dbs.sql | 5 ++- .../templates/backend-deployment.yaml | 6 ++- .../backstage/templates/backend-secret.yaml | 1 + .../templates/backstage-app-config.yaml | 7 ++++ .../templates/backstage-auth-config.yaml | 21 ++++++++++ .../chart/backstage/templates/ingress.yaml | 28 +++---------- contrib/chart/backstage/values.yaml | 31 ++++++++------- 8 files changed, 68 insertions(+), 70 deletions(-) create mode 100644 contrib/chart/backstage/templates/backstage-auth-config.yaml diff --git a/contrib/chart/backstage/files/app-config.local.yaml.tpl b/contrib/chart/backstage/files/app-config.local.yaml.tpl index 7fdfeb79a8..857e9ecafe 100644 --- a/contrib/chart/backstage/files/app-config.local.yaml.tpl +++ b/contrib/chart/backstage/files/app-config.local.yaml.tpl @@ -1,6 +1,7 @@ backend: lighthouseHostname: {{ include "lighthouse.serviceName" . | quote }} - listen: {{ .Values.appConfig.backend.listen | quote }} + listen: + port: {{ .Values.appConfig.backend.listen.port | default 7000 }} cors: origin: {{ .Values.appConfig.backend.cors.origin | quote }} database: @@ -35,38 +36,10 @@ catalog: 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 }} + +scaffolder: + azure: + baseUrl: https://dev.azure.com/some-org diff --git a/contrib/chart/backstage/files/create-backend-dbs.sql b/contrib/chart/backstage/files/create-backend-dbs.sql index e8124dbd22..7902b15b6d 100644 --- a/contrib/chart/backstage/files/create-backend-dbs.sql +++ b/contrib/chart/backstage/files/create-backend-dbs.sql @@ -5,7 +5,10 @@ create database {{ $backendDb }}; grant all privileges on database {{ $backendDb }} to {{ $user }}; +create database backstage_plugin_auth; +grant all privileges on database backstage_plugin_auth to {{ $user }}; + {{ if not (eq $backendDb $lighthouseDb) }} create database {{ $lighthouseDb }}; grant all privileges on database {{ $lighthouseDb }} to {{ $user }}; -{{ end }} \ No newline at end of file +{{ end }} diff --git a/contrib/chart/backstage/templates/backend-deployment.yaml b/contrib/chart/backstage/templates/backend-deployment.yaml index 9c6e8da67c..c57764db8e 100644 --- a/contrib/chart/backstage/templates/backend-deployment.yaml +++ b/contrib/chart/backstage/templates/backend-deployment.yaml @@ -34,8 +34,12 @@ spec: name: {{ include "backstage.fullname" . }}-backend - configMapRef: name: {{ include "backstage.fullname" . }}-app-env + - configMapRef: + name: {{ include "backstage.fullname" . }}-auth env: - - name: APP_CONFIG_backend_postgresPassword + - name: NODE_ENV + value: {{ .Values.backend.nodeEnv | default "development" }} + - name: APP_CONFIG_backend_database_connection_password valueFrom: secretKeyRef: name: {{ include "backend.postgresql.passwordSecret" .}} diff --git a/contrib/chart/backstage/templates/backend-secret.yaml b/contrib/chart/backstage/templates/backend-secret.yaml index 3acb220d81..ab8fff00ec 100644 --- a/contrib/chart/backstage/templates/backend-secret.yaml +++ b/contrib/chart/backstage/templates/backend-secret.yaml @@ -17,4 +17,5 @@ stringData: CIRCLECI_AUTH_TOKEN: {{ .Values.auth.circleciAuthToken }} GITHUB_ACCESS_TOKEN: {{ .Values.auth.githubAccessToken }} GITLAB_ACCESS_TOKEN: {{ .Values.auth.gitlabAccessToken }} + AZURE_PRIVATE_TOKEN: {{ .Values.auth.azure.api.token }} {{- end }} diff --git a/contrib/chart/backstage/templates/backstage-app-config.yaml b/contrib/chart/backstage/templates/backstage-app-config.yaml index a75fc8108d..e419e5d14a 100644 --- a/contrib/chart/backstage/templates/backstage-app-config.yaml +++ b/contrib/chart/backstage/templates/backstage-app-config.yaml @@ -17,3 +17,10 @@ data: 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 }} + APP_CONFIG_backend_database_connection_ssl_rejectUnauthorized: "false" + 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 }} + diff --git a/contrib/chart/backstage/templates/backstage-auth-config.yaml b/contrib/chart/backstage/templates/backstage-auth-config.yaml new file mode 100644 index 0000000000..7dcf8379aa --- /dev/null +++ b/contrib/chart/backstage/templates/backstage-auth-config.yaml @@ -0,0 +1,21 @@ +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. + # Regardless, it is not decided by me. + 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/ingress.yaml b/contrib/chart/backstage/templates/ingress.yaml index 6996bb5d8d..a4a3c0ff00 100644 --- a/contrib/chart/backstage/templates/ingress.yaml +++ b/contrib/chart/backstage/templates/ingress.yaml @@ -1,37 +1,21 @@ apiVersion: networking.k8s.io/v1beta1 kind: Ingress metadata: - name: {{ include "backstage.fullname" . }}-ingress-backend + name: {{ include "backstage.fullname" . }}-ingress {{- with .Values.ingress.annotations }} annotations: - nginx.ingress.kubernetes.io/rewrite-target: /$2 {{- toYaml . | nindent 4 }} {{- end }} spec: rules: - http: paths: - - backend: + - path: /api + backend: serviceName: {{ include "backend.serviceName" . }} servicePort: 80 - path: /api(/|$)(.*) ---- -# Having rewrite rules in an ingress with a '/' path results in an error when loading the -# site "Unexpected token: <". That's why we need two ingress resources -# See https://stackoverflow.com/questions/59931177/gke-install-nginx-ingress-with-static-ip-and-fanout -apiVersion: networking.k8s.io/v1beta1 -kind: Ingress -metadata: - name: {{ include "backstage.fullname" . }}-ingress-frontend - {{- with .Values.ingress.annotations }} - annotations: - {{- toYaml . | nindent 4 }} - {{- end }} -spec: - rules: - - http: - paths: - - backend: + - path: / + backend: serviceName: {{ include "frontend.serviceName" . }} servicePort: 80 - path: / + diff --git a/contrib/chart/backstage/values.yaml b/contrib/chart/backstage/values.yaml index 64cf5e91be..9616efe58d 100644 --- a/contrib/chart/backstage/values.yaml +++ b/contrib/chart/backstage/values.yaml @@ -6,8 +6,8 @@ frontend: enabled: true replicaCount: 1 image: - repository: roadiehq/backstage-k8s-demo-frontend - tag: latest + repository: martinaif/backstage-k8s-demo-frontend + tag: test1 pullPolicy: IfNotPresent containerPort: 80 resources: @@ -18,10 +18,11 @@ frontend: backend: enabled: true + nodeEnv: development replicaCount: 1 image: - repository: roadiehq/backstage-k8s-demo-backend - tag: latest + repository: martinaif/backstage-k8s-demo-backend + tag: test1 pullPolicy: IfNotPresent containerPort: 7000 resources: @@ -81,20 +82,21 @@ appConfig: baseUrl: https://demo.example.com title: Backstage backend: - baseUrl: /api - listen: 0.0.0.0:7000 + baseUrl: https://demo.example.com + listen: + port: 7000 cors: origin: https://demo.example.com database: client: pg connection: - database: backend + database: backstage_plugin_catalog host: user: port: password: ssl: - rejectUnauthorized: false + rejectUnauthorized: true ca: sentry: organization: spotify @@ -116,7 +118,7 @@ appConfig: providers: google: development: - appOrigin: 'http://localhost:3000/' + appOrigin: "http://localhost:3000/" secure: false clientId: $secret: @@ -126,7 +128,7 @@ appConfig: env: AUTH_GOOGLE_CLIENT_SECRET github: development: - appOrigin: 'http://localhost:3000/' + appOrigin: "http://localhost:3000/" secure: false clientId: $secret: @@ -139,7 +141,7 @@ appConfig: env: AUTH_GITHUB_ENTERPRISE_INSTANCE_URL gitlab: development: - appOrigin: 'http://localhost:3000/' + appOrigin: "http://localhost:3000/" secure: false clientId: $secret: @@ -152,7 +154,7 @@ appConfig: env: GITLAB_BASE_URL okta: development: - appOrigin: 'http://localhost:3000/' + appOrigin: "http://localhost:3000/" secure: false clientId: $secret: @@ -165,7 +167,7 @@ appConfig: env: AUTH_OKTA_AUDIENCE oauth2: development: - appOrigin: 'http://localhost:3000/' + appOrigin: "http://localhost:3000/" secure: false clientId: $secret: @@ -230,6 +232,9 @@ auth: clientId: f clientSecret: f tenantId: f + azure: + api: + token: h sentryToken: e rollbarAccountToken: f # This is a 'Personal Access Token' From 19932ff7f51bd51cf3f0522635afd6138e17ded4 Mon Sep 17 00:00:00 2001 From: Martina Iglesias Fernandez Date: Mon, 5 Oct 2020 17:29:28 +0200 Subject: [PATCH 05/24] Use hosts in ingress based on baseUrls again --- .../chart/backstage/templates/ingress.yaml | 31 +++++++++++++------ 1 file changed, 21 insertions(+), 10 deletions(-) diff --git a/contrib/chart/backstage/templates/ingress.yaml b/contrib/chart/backstage/templates/ingress.yaml index a4a3c0ff00..2ff713a3b6 100644 --- a/contrib/chart/backstage/templates/ingress.yaml +++ b/contrib/chart/backstage/templates/ingress.yaml @@ -8,14 +8,25 @@ metadata: {{- end }} spec: rules: - - http: - paths: - - path: /api - backend: - serviceName: {{ include "backend.serviceName" . }} - servicePort: 80 - - path: / - backend: - serviceName: {{ include "frontend.serviceName" . }} - servicePort: 80 + - host: {{ .Values.appConfig.app.baseUrl | trimPrefix "https://" | trimSuffix "/" }} + http: + paths: + - path: / + backend: + serviceName: {{ include "frontend.serviceName" . }} + servicePort: 80 + - host: {{ .Values.appConfig.backend.baseUrl | trimPrefix "https://" | trimSuffix "/" }} + http: + paths: + - path: /api + backend: + serviceName: {{ include "backend.serviceName" . }} + servicePort: 80 + - host: {{ .Values.appConfig.lighthouse.baseUrl | trimPrefix "https://" | trimSuffix "/" }} + http: + paths: + - path: / + backend: + serviceName: {{ include "lighthouse.serviceName" . }} + servicePort: 80 From 4b67e8c17623ed13a451925b229eba7892ac70a8 Mon Sep 17 00:00:00 2001 From: Martina Iglesias Fernandez Date: Mon, 5 Oct 2020 17:29:29 +0200 Subject: [PATCH 06/24] Draft README --- contrib/chart/backstage/README.md | 77 ++++++++++++++++++++++++++++++- 1 file changed, 76 insertions(+), 1 deletion(-) diff --git a/contrib/chart/backstage/README.md b/contrib/chart/backstage/README.md index bb2ff84411..bccc934da8 100644 --- a/contrib/chart/backstage/README.md +++ b/contrib/chart/backstage/README.md @@ -1 +1,76 @@ -# TO DO +# Backstage demo helm charts + +This folder contains Helm charts that can easily create a Kubernetes deployment of a demo Backstage app. + +To deploy it chose a DNS name where this demo will live and run + +``` +git clone https://github.com/spotify/backstage.git +cd contrib/chart/backstage +helm install backstage . \ +--set appConfig.app.baseUrl="https://backstage.mydomain.com" \ +--set appConfig.backend.baseUrl="https://backstage.mydomain.com" \ +--set appConfig.backend.cors.origin.baseUrl="https://backstage.mydomain.com" \ +``` + +This command will deploy the following pieces: + +- Backstage frontend +- Backstage backend with scaffolder and auth plugins +- (optional) a PostgreSQL instance +- lighthouse plugin +- ingress + +After a few minutes Backstage should be up and running in your cluster under the DNS specified earlier. + +Make sure to create the appropriate DNS entry in your infrastructure. To find the IP address run + +```bash +$ kubectl get ingress +NAME HOSTS ADDRESS PORTS AGE +backstage-ingress * 34.77.171.192 80 17m +``` + +> **NOTE**: this is not a production ready deployment. + +## Customization + +Configuring a connection to an existing PostgreSQL instance is possible through the chart's values: + +```bash +appConfig: + backend: + database: + client: pg + connection: + database: backstage_plugin_catalog + host: + user: + port: + password: + ssl: + rejectUnauthorized: true +``` + +For the CA, create a `configMap` named `ca.crt`: + +``` +kubectl create configmap %s --from-file=ca.crt" +``` + +## Troubleshooting + +#### Unable to verify signature + +``` +Backend failed to start up Error: unable to verify the first certificate + at TLSSocket.onConnectSecure (_tls_wrap.js:1501:34) + at TLSSocket.emit (events.js:315:20) + at TLSSocket._finishInit (_tls_wrap.js:936:8) + at TLSWrap.ssl.onhandshakedone (_tls_wrap.js:710:12) { + code: 'UNABLE_TO_VERIFY_LEAF_SIGNATURE' +``` + +This error happens in the backend when it tries to connect to the configured PostgreSQL database and the specified CA is not correct. The solution is to make sure that the contents of the `configmap` that holds the certificate match the CA for the PostgreSQL instance. A workaround is to set `appConfig.backend.database.connection.ssl.rejectUnauthorized` to `false` in the chart's values. + + From 30c72a6ee0bf258bf378e5d4935544568f2f18f0 Mon Sep 17 00:00:00 2001 From: Martina Iglesias Fernandez Date: Mon, 5 Oct 2020 17:29:29 +0200 Subject: [PATCH 07/24] Fix prettier --- contrib/chart/backstage/values.yaml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/contrib/chart/backstage/values.yaml b/contrib/chart/backstage/values.yaml index 9616efe58d..3993d3fee3 100644 --- a/contrib/chart/backstage/values.yaml +++ b/contrib/chart/backstage/values.yaml @@ -118,7 +118,7 @@ appConfig: providers: google: development: - appOrigin: "http://localhost:3000/" + appOrigin: 'http://localhost:3000/' secure: false clientId: $secret: @@ -128,7 +128,7 @@ appConfig: env: AUTH_GOOGLE_CLIENT_SECRET github: development: - appOrigin: "http://localhost:3000/" + appOrigin: 'http://localhost:3000/' secure: false clientId: $secret: @@ -141,7 +141,7 @@ appConfig: env: AUTH_GITHUB_ENTERPRISE_INSTANCE_URL gitlab: development: - appOrigin: "http://localhost:3000/" + appOrigin: 'http://localhost:3000/' secure: false clientId: $secret: @@ -154,7 +154,7 @@ appConfig: env: GITLAB_BASE_URL okta: development: - appOrigin: "http://localhost:3000/" + appOrigin: 'http://localhost:3000/' secure: false clientId: $secret: @@ -167,7 +167,7 @@ appConfig: env: AUTH_OKTA_AUDIENCE oauth2: development: - appOrigin: "http://localhost:3000/" + appOrigin: 'http://localhost:3000/' secure: false clientId: $secret: From 8c8560f3578a22d6914bbd7a241b6890c57fb9d7 Mon Sep 17 00:00:00 2001 From: Martina Iglesias Fernandez Date: Mon, 5 Oct 2020 17:29:30 +0200 Subject: [PATCH 08/24] Fix name of lightouse configmap ref --- contrib/chart/backstage/templates/lighthouse-deployment.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contrib/chart/backstage/templates/lighthouse-deployment.yaml b/contrib/chart/backstage/templates/lighthouse-deployment.yaml index 25eccd10e6..70341a2a22 100644 --- a/contrib/chart/backstage/templates/lighthouse-deployment.yaml +++ b/contrib/chart/backstage/templates/lighthouse-deployment.yaml @@ -32,7 +32,7 @@ spec: envFrom: - configMapRef: - name: backstage-lighthouse + name: {{ include "backstage.fullname" . -}}-lighthouse - configMapRef: name: {{ include "backstage.fullname" . }}-app-env From 5db315a48b43c84c2348a3ca725da767f1bf09fc Mon Sep 17 00:00:00 2001 From: Martina Iglesias Fernandez Date: Mon, 5 Oct 2020 17:29:31 +0200 Subject: [PATCH 09/24] Add chart testing workflow --- .github/workflows/charts-lint-test.yaml | 32 +++++++++++++++++++ chart_schema.yaml | 37 ++++++++++++++++++++++ contrib/chart/backstage/Chart.yaml | 2 +- ct.yaml | 8 +++++ lintconf.yaml | 42 +++++++++++++++++++++++++ 5 files changed, 120 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/charts-lint-test.yaml create mode 100644 chart_schema.yaml create mode 100644 ct.yaml create mode 100644 lintconf.yaml diff --git a/.github/workflows/charts-lint-test.yaml b/.github/workflows/charts-lint-test.yaml new file mode 100644 index 0000000000..ab73407e9d --- /dev/null +++ b/.github/workflows/charts-lint-test.yaml @@ -0,0 +1,32 @@ +name: Lint and Test Charts + +on: pull_request + +jobs: + lint-test: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v2 + + - name: Fetch history + run: git fetch --prune --unshallow + + - name: Run chart-testing (lint) + id: lint + uses: helm/chart-testing-action@v1.1.0 + with: + command: lint + config: ct.yaml + + - name: Create kind cluster + uses: helm/kind-action@v1.0.0 + # Only build a kind cluster if there are chart changes to test. + if: steps.lint.outputs.changed == 'true' + + - name: Install charts + uses: helm/chart-testing-action@v1.1.0 + if: steps.lint.outputs.changed == 'true' + with: + command: install + config: ct.yaml diff --git a/chart_schema.yaml b/chart_schema.yaml new file mode 100644 index 0000000000..61fc3e14b2 --- /dev/null +++ b/chart_schema.yaml @@ -0,0 +1,37 @@ +name: str() +home: str(required=False) +version: str() +apiVersion: str() +appVersion: any(str(), num(), required=False) +description: str() +keywords: list(str(), required=False) +sources: list(str(), required=False) +maintainers: list(include('maintainer'), required=False) +dependencies: list(include('dependency'), required=False) +icon: str(required=False) +engine: str(required=False) +condition: str(required=False) +tags: str(required=False) +deprecated: bool(required=False) +kubeVersion: str(required=False) +annotations: map(str(), str(), required=False) +type: str(required=False) +--- +maintainer: + name: str() + email: str(required=False) + url: str(required=False) +--- +dependency: + name: str() + version: str() + repository: str() + condition: str(required=False) + tags: list(str(), required=False) + enabled: bool(required=False) + import-values: any(list(str()), list(include('import-value')), required=False) + alias: str(required=False) +--- +import-value: + child: str() + parent: str() diff --git a/contrib/chart/backstage/Chart.yaml b/contrib/chart/backstage/Chart.yaml index 92b5e3e309..7d2a489199 100644 --- a/contrib/chart/backstage/Chart.yaml +++ b/contrib/chart/backstage/Chart.yaml @@ -22,7 +22,7 @@ dependencies: repository: https://charts.bitnami.com/bitnami maintainers: - - name: Martina Iglesias Fernandez + - name: Martina Iglesias Fernández email: martina@roadie.io url: https://roadie.io - name: David Tuite diff --git a/ct.yaml b/ct.yaml new file mode 100644 index 0000000000..53a47c95c2 --- /dev/null +++ b/ct.yaml @@ -0,0 +1,8 @@ +charts: + - contrib/chart/backstage + +validate-maintainers: false +debug: true +target-branch: master +chart-repos: + - bitnami=https://charts.bitnami.com/bitnami diff --git a/lintconf.yaml b/lintconf.yaml new file mode 100644 index 0000000000..b9eb34ff2d --- /dev/null +++ b/lintconf.yaml @@ -0,0 +1,42 @@ +--- +rules: + braces: + min-spaces-inside: 0 + max-spaces-inside: 0 + min-spaces-inside-empty: -1 + max-spaces-inside-empty: -1 + brackets: + min-spaces-inside: 0 + max-spaces-inside: 0 + min-spaces-inside-empty: -1 + max-spaces-inside-empty: -1 + colons: + max-spaces-before: 0 + max-spaces-after: 1 + commas: + max-spaces-before: 0 + min-spaces-after: 1 + max-spaces-after: 1 + comments: + require-starting-space: true + min-spaces-from-content: 2 + document-end: disable + document-start: disable # No --- to start a file + empty-lines: + max: 2 + max-start: 0 + max-end: 0 + hyphens: + max-spaces-after: 1 + indentation: + spaces: consistent + indent-sequences: whatever # - list indentation will handle both indentation and without + check-multi-line-strings: false + key-duplicates: enable + line-length: disable # Lines can be any length + new-line-at-end-of-file: enable + new-lines: + type: unix + trailing-spaces: enable + truthy: + level: warning From 56fae192b548da6ea32a131dae2e5a5116446d0c Mon Sep 17 00:00:00 2001 From: Martina Iglesias Fernandez Date: Mon, 5 Oct 2020 17:29:31 +0200 Subject: [PATCH 10/24] Fix postgres password secret --- .../backstage/templates/postgresql-password-secret.yaml | 6 +++--- contrib/chart/backstage/values.yaml | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/contrib/chart/backstage/templates/postgresql-password-secret.yaml b/contrib/chart/backstage/templates/postgresql-password-secret.yaml index 7e72888607..9685130a03 100644 --- a/contrib/chart/backstage/templates/postgresql-password-secret.yaml +++ b/contrib/chart/backstage/templates/postgresql-password-secret.yaml @@ -11,7 +11,7 @@ metadata: "helm.sh/hook": "pre-install" "helm.sh/hook-delete-policy": "before-hook-creation" data: - postgresql-password: {{ .Values.appConfig.backend.database.connection.password }} + postgresql-password: {{ .Values.appConfig.backend.database.connection.password | b64enc }} {{- end }} {{- if not .Values.postgresql.enabled }} --- @@ -26,5 +26,5 @@ metadata: "helm.sh/hook": "pre-install" "helm.sh/hook-delete-policy": "before-hook-creation" data: - postgresql-password: {{ .Values.lighthouse.database.connection.password }} -{{- end }} \ No newline at end of file + postgresql-password: {{ .Values.lighthouse.database.connection.password | b64enc }} +{{- end }} diff --git a/contrib/chart/backstage/values.yaml b/contrib/chart/backstage/values.yaml index 3993d3fee3..37ac9b2243 100644 --- a/contrib/chart/backstage/values.yaml +++ b/contrib/chart/backstage/values.yaml @@ -96,7 +96,7 @@ appConfig: port: password: ssl: - rejectUnauthorized: true + rejectUnauthorized: false ca: sentry: organization: spotify From 024b8bceee2ac5500a695546c1e6acb3a4dacb42 Mon Sep 17 00:00:00 2001 From: Martina Iglesias Fernandez Date: Mon, 5 Oct 2020 17:29:32 +0200 Subject: [PATCH 11/24] Add docs --- contrib/chart/backstage/README.md | 42 ++++++++++++++++++++++++------- 1 file changed, 33 insertions(+), 9 deletions(-) diff --git a/contrib/chart/backstage/README.md b/contrib/chart/backstage/README.md index bccc934da8..51f0bb0d7c 100644 --- a/contrib/chart/backstage/README.md +++ b/contrib/chart/backstage/README.md @@ -35,27 +35,51 @@ backstage-ingress * 34.77.171.192 80 17m ## Customization -Configuring a connection to an existing PostgreSQL instance is possible through the chart's values: +Configuring a connection to an existing PostgreSQL instance is possible through the chart's values. + +First create a yaml file with the configuration you want to override, for example `backstage-prod.yaml`: ```bash +postgresql: + enabled: false + appConfig: + app: + baseUrl: https://backstage-demo.mydomain.com + title: Backstage backend: + baseUrl: https://backstage-demo.mydomain.com + cors: + origin: https://backstage-demo.mydomain.com database: client: pg connection: database: backstage_plugin_catalog host: - user: - port: + user: password: - ssl: - rejectUnauthorized: true -``` - -For the CA, create a `configMap` named `ca.crt`: +lighthouse: + database: + client: pg + connection: + host: + user: + password: + database: lighthouse_audit_service ``` -kubectl create configmap %s --from-file=ca.crt" + +For the CA, create a `configMap` named `-postgres-ca` with a file called `ca.crt`: + +``` +kubectl create configmap my-backstage --from-file=ca.crt" +``` + +Now install the helm chart: + +``` +cd contrib/chart/backstage +helm install -f backstage-prod.yaml my-backstage . ``` ## Troubleshooting From 4851528f2ee60e68f5d534b0b75f4ffdff52f24a Mon Sep 17 00:00:00 2001 From: Martina Iglesias Fernandez Date: Mon, 5 Oct 2020 17:29:33 +0200 Subject: [PATCH 12/24] Make demo data configurable and add more docs --- contrib/chart/backstage/README.md | 18 ++++++++++++++++++ .../backstage/files/app-config.local.yaml.tpl | 4 ++++ contrib/chart/backstage/values.yaml | 1 + 3 files changed, 23 insertions(+) diff --git a/contrib/chart/backstage/README.md b/contrib/chart/backstage/README.md index 51f0bb0d7c..22c1fae5df 100644 --- a/contrib/chart/backstage/README.md +++ b/contrib/chart/backstage/README.md @@ -35,6 +35,8 @@ backstage-ingress * 34.77.171.192 80 17m ## Customization +### Custom PostgreSQL instance + Configuring a connection to an existing PostgreSQL instance is possible through the chart's values. First create a yaml file with the configuration you want to override, for example `backstage-prod.yaml`: @@ -82,6 +84,22 @@ cd contrib/chart/backstage helm install -f backstage-prod.yaml my-backstage . ``` +### Different namespace + +To install the charts a specific namespace use `--namespace `: + +``` +helm install -f my_values.yaml --namespace demos backstage . +``` + +### Disable loading of demo data + +To deploy backstage with the pre-loaded demo data disable `backend.demoData`: + +``` +helm install -f my_values.yaml --set backend.demoData=false backstage . +``` + ## Troubleshooting #### Unable to verify signature diff --git a/contrib/chart/backstage/files/app-config.local.yaml.tpl b/contrib/chart/backstage/files/app-config.local.yaml.tpl index 857e9ecafe..d803213a40 100644 --- a/contrib/chart/backstage/files/app-config.local.yaml.tpl +++ b/contrib/chart/backstage/files/app-config.local.yaml.tpl @@ -16,6 +16,7 @@ backend: ca: {{ include "backstage.backend.postgresCaFilename" . | quote }} catalog: +{{- if .Values.backend.demoData }} locations: # Backstage example components - type: github @@ -32,6 +33,9 @@ catalog: # Backstage example templates - type: github target: https://github.com/spotify/backstage/blob/master/plugins/scaffolder-backend/sample-templates/all-templates.yaml +{{- else }} + locations: [] +{{- end }} sentry: organization: {{ .Values.appConfig.sentry.organization | quote }} diff --git a/contrib/chart/backstage/values.yaml b/contrib/chart/backstage/values.yaml index 37ac9b2243..ea9cd077f8 100644 --- a/contrib/chart/backstage/values.yaml +++ b/contrib/chart/backstage/values.yaml @@ -19,6 +19,7 @@ frontend: backend: enabled: true nodeEnv: development + demoData: true replicaCount: 1 image: repository: martinaif/backstage-k8s-demo-backend From 34f6182e4820e0b83d562212c84d91da9dfa1a6e Mon Sep 17 00:00:00 2001 From: Martina Iglesias Fernandez Date: Tue, 6 Oct 2020 16:15:14 +0200 Subject: [PATCH 13/24] Fix ingress and baseUrls --- .../backstage/files/app-config.local.yaml.tpl | 4 --- .../chart/backstage/templates/ingress.yaml | 25 +++++++++++++------ 2 files changed, 18 insertions(+), 11 deletions(-) diff --git a/contrib/chart/backstage/files/app-config.local.yaml.tpl b/contrib/chart/backstage/files/app-config.local.yaml.tpl index d803213a40..f5e0b94225 100644 --- a/contrib/chart/backstage/files/app-config.local.yaml.tpl +++ b/contrib/chart/backstage/files/app-config.local.yaml.tpl @@ -40,10 +40,6 @@ catalog: sentry: organization: {{ .Values.appConfig.sentry.organization | quote }} - -lighthouse: - baseUrl: {{ .Values.appConfig.lighthouse.baseUrl | quote }} - scaffolder: azure: baseUrl: https://dev.azure.com/some-org diff --git a/contrib/chart/backstage/templates/ingress.yaml b/contrib/chart/backstage/templates/ingress.yaml index 2ff713a3b6..df501b18d0 100644 --- a/contrib/chart/backstage/templates/ingress.yaml +++ b/contrib/chart/backstage/templates/ingress.yaml @@ -1,3 +1,6 @@ +{{- $frontendUrl := urlParse .Values.appConfig.app.baseUrl}} +{{- $backendUrl := urlParse .Values.appConfig.backend.baseUrl}} +{{- $lighthouseUrl := urlParse .Values.appConfig.lighthouse.baseUrl}} apiVersion: networking.k8s.io/v1beta1 kind: Ingress metadata: @@ -8,24 +11,32 @@ metadata: {{- end }} spec: rules: - - host: {{ .Values.appConfig.app.baseUrl | trimPrefix "https://" | trimSuffix "/" }} + - host: {{ $frontendUrl.host }} http: paths: - path: / backend: serviceName: {{ include "frontend.serviceName" . }} servicePort: 80 - - host: {{ .Values.appConfig.backend.baseUrl | trimPrefix "https://" | trimSuffix "/" }} - http: - paths: - - path: /api + - path: /techdocs backend: serviceName: {{ include "backend.serviceName" . }} servicePort: 80 - - host: {{ .Values.appConfig.lighthouse.baseUrl | trimPrefix "https://" | trimSuffix "/" }} + - path: /metadata + backend: + serviceName: {{ include "backend.serviceName" . }} + servicePort: 80 + - host: {{ $backendUrl.host }} http: paths: - - path: / + - path: {{ $backendUrl.path | default "/" }} + backend: + serviceName: {{ include "backend.serviceName" . }} + servicePort: 80 + - host: {{ $lighthouseUrl.host }} + http: + paths: + - path: {{ $lighthouseUrl.path | default "/" }} backend: serviceName: {{ include "lighthouse.serviceName" . }} servicePort: 80 From d517a32bcbc59005e801547b34070adc43002951 Mon Sep 17 00:00:00 2001 From: Martina Iglesias Fernandez Date: Tue, 6 Oct 2020 19:21:06 +0200 Subject: [PATCH 14/24] Fix ingress for lighthouse connection --- .../chart/backstage/templates/ingress.yaml | 46 ++++++++++++++++++- 1 file changed, 44 insertions(+), 2 deletions(-) diff --git a/contrib/chart/backstage/templates/ingress.yaml b/contrib/chart/backstage/templates/ingress.yaml index df501b18d0..481bacbfb3 100644 --- a/contrib/chart/backstage/templates/ingress.yaml +++ b/contrib/chart/backstage/templates/ingress.yaml @@ -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: @@ -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" . }} @@ -26,6 +33,12 @@ 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: @@ -33,11 +46,40 @@ spec: 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 }} From e0a960558b71ff37232046e1867fa647b3da4a5a Mon Sep 17 00:00:00 2001 From: Martina Iglesias Fernandez Date: Wed, 7 Oct 2020 15:50:27 +0200 Subject: [PATCH 15/24] 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 From 9f44b650f0d46ac9c6a4cf8a916b9d031c0dc99e Mon Sep 17 00:00:00 2001 From: Martina Iglesias Fernandez Date: Wed, 7 Oct 2020 16:24:08 +0200 Subject: [PATCH 16/24] Fix ingress bug --- contrib/chart/backstage/templates/ingress.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contrib/chart/backstage/templates/ingress.yaml b/contrib/chart/backstage/templates/ingress.yaml index 7705d52a93..034862ef75 100644 --- a/contrib/chart/backstage/templates/ingress.yaml +++ b/contrib/chart/backstage/templates/ingress.yaml @@ -42,7 +42,7 @@ spec: {{/* Route lighthouse through a different host */}} {{- if not ( eq $frontendUrl.host $lighthouseUrl.host ) }} - - host: {{ $lighthouseUrl.host }} + - host: {{ $lighthouseUrl.host }} http: paths: - path: {{ $lighthouseUrl.path | default "/" }} From 6289cea398a13124ec19b7cbb92c43378a4214f8 Mon Sep 17 00:00:00 2001 From: Martina Iglesias Fernandez Date: Wed, 7 Oct 2020 17:37:03 +0200 Subject: [PATCH 17/24] Add more documentation to charts README and k8s guide --- contrib/chart/backstage/README.md | 115 +++++++++++++++++++++++-- docs/getting-started/deployment-k8s.md | 63 +++++++++++++- 2 files changed, 169 insertions(+), 9 deletions(-) diff --git a/contrib/chart/backstage/README.md b/contrib/chart/backstage/README.md index 22c1fae5df..1a045e09ca 100644 --- a/contrib/chart/backstage/README.md +++ b/contrib/chart/backstage/README.md @@ -2,15 +2,43 @@ This folder contains Helm charts that can easily create a Kubernetes deployment of a demo Backstage app. -To deploy it chose a DNS name where this demo will live and run +### Pre-requisites + +These charts depend on the `nginx-ingress` controller being present in the cluster. If it's not already installed you +can run: + +``` +helm repo add ingress-nginx https://kubernetes.github.io/ingress-nginx +helm install nginx-ingress ingress-nginx/ingress-nginx +``` + +### Installing the charts + +After choosing a DNS name where backstage will be hosted create a yaml file for your custom configuration. + +``` +appConfig: + app: + baseUrl: https://backstage.mydomain.com + title: Backstage + backend: + baseUrl: https://backstage.mydomain.com + cors: + origin: https://backstage.mydomain.com + lighthouse: + baseUrl: https://backstage.mydomain.com/lighthouse-api + techdocs: + storageUrl: https://backstage.mydomain.com/api/techdocs/static/docs + requestUrl: https://backstage.mydomain.com/api/techdocs + +``` + +Then use it to run: ``` git clone https://github.com/spotify/backstage.git cd contrib/chart/backstage -helm install backstage . \ ---set appConfig.app.baseUrl="https://backstage.mydomain.com" \ ---set appConfig.backend.baseUrl="https://backstage.mydomain.com" \ ---set appConfig.backend.cors.origin.baseUrl="https://backstage.mydomain.com" \ +helm install -f backstage-mydomain.yaml backstage . ``` This command will deploy the following pieces: @@ -23,16 +51,21 @@ This command will deploy the following pieces: After a few minutes Backstage should be up and running in your cluster under the DNS specified earlier. -Make sure to create the appropriate DNS entry in your infrastructure. To find the IP address run +Make sure to create the appropriate DNS entry in your infrastructure. To find the public IP address run: ```bash $ kubectl get ingress NAME HOSTS ADDRESS PORTS AGE -backstage-ingress * 34.77.171.192 80 17m +backstage-ingress * 123.1.2.3 80 17m ``` > **NOTE**: this is not a production ready deployment. +## Caveats + +The current implementation does not generate certificates for the ingress which means the browser will alert that the +site is insecure and using self-signed certificates. + ## Customization ### Custom PostgreSQL instance @@ -60,6 +93,9 @@ appConfig: host: user: password: + lighthouse: + baseUrl: https://backstage-demo.mydomain.com/lighthouse-api + lighthouse: database: client: pg @@ -84,6 +120,27 @@ cd contrib/chart/backstage helm install -f backstage-prod.yaml my-backstage . ``` +### Use your own docker images + +The docker images used for the deployment can be configured through the charts values: + +``` +frontend: + image: + repository: + tag: + +backend: + image: + repository: + tag: + +frontend: + image: + repository: +``` + ### Different namespace To install the charts a specific namespace use `--namespace `: @@ -100,8 +157,38 @@ To deploy backstage with the pre-loaded demo data disable `backend.demoData`: helm install -f my_values.yaml --set backend.demoData=false backstage . ``` +### Other options + +For more customization options take a look at the [values.yaml](/contrib/chart/backstage/values.yaml) file. + ## Troubleshooting +Some resources created by these charts are meant to survive after upgrades and even after uninstalls. When +troubleshooting these charts it can be useful to delete these resources between re-installs. + +Secrets: + +``` +-postgresql-certs -- contains the certificates used by the deployed PostgreSQL +``` + +Persistent volumes: + +``` +data--postgresql-0 -- this is the data volume used by PostgreSQL to store data and configuration +``` + +> **NOTE**: this volume also stores the configuration for PostgreSQL which includes things like the password for the +> `postgres` user. This means that uninstalling and re-installing the charts with `postgres.enabled` set to `true` and +> auto generated passwords will fail. The solution is to delete this volume with +> `kubectl delete pvc data--postgresql-0` + +ConfigMaps: + +``` +-postgres-ca -- contains the generated CA certificate for PostgreSQL when `postgres` is enabled +``` + #### Unable to verify signature ``` @@ -113,6 +200,18 @@ Backend failed to start up Error: unable to verify the first certificate code: 'UNABLE_TO_VERIFY_LEAF_SIGNATURE' ``` -This error happens in the backend when it tries to connect to the configured PostgreSQL database and the specified CA is not correct. The solution is to make sure that the contents of the `configmap` that holds the certificate match the CA for the PostgreSQL instance. A workaround is to set `appConfig.backend.database.connection.ssl.rejectUnauthorized` to `false` in the chart's values. +This error happens in the backend when it tries to connect to the configured PostgreSQL database and the specified CA is not correct. The solution is to make sure that the contents of the `configMap` that holds the certificate match the CA for the PostgreSQL instance. A workaround is to set `appConfig.backend.database.connection.ssl.rejectUnauthorized` to `false` in the chart's values. + +## Uninstalling Backstage + +To uninstall Backstage simply run: + +``` +RELEASE_NAME= # use `helm list` to find out the name +helm uninstall ${RELEASE_NAME} +kubectl delete pvc data-${RELEASE_NAME}-postgresql-0 +kubectl delete secret ${RELEASE_NAME}-postgresql-certs +kubectl delete configMap ${RELEASE_NAME}-postgres-ca +``` diff --git a/docs/getting-started/deployment-k8s.md b/docs/getting-started/deployment-k8s.md index ddcbd290c6..c2682d85a4 100644 --- a/docs/getting-started/deployment-k8s.md +++ b/docs/getting-started/deployment-k8s.md @@ -4,4 +4,65 @@ title: Kubernetes description: Documentation on Kubernetes and K8s Deployment --- -Coming soon! +# Helm charts + +An example Backstage app can be deployed in Kubernetes using the [Backstage Helm +charts][backstage-helm-charts] + +First, choose a DNS name where backstage will be hosted create a yaml file for +your custom configuration. + +``` +appConfig: + app: + baseUrl: https://backstage.mydomain.com + title: Backstage + backend: + baseUrl: https://backstage.mydomain.com + cors: + origin: https://backstage.mydomain.com + lighthouse: + baseUrl: https://backstage.mydomain.com/lighthouse-api + techdocs: + storageUrl: https://backstage.mydomain.com/api/techdocs/static/docs + requestUrl: https://backstage.mydomain.com/api/techdocs + +``` + +Then use it to run: + +``` +git clone https://github.com/spotify/backstage.git +cd contrib/chart/backstage +helm install -f backstage-mydomain.yaml backstage . +``` + +This command will deploy the following pieces: + +- Backstage frontend +- Backstage backend with scaffolder and auth plugins +- (optional) a PostgreSQL instance +- lighthouse plugin +- ingress + +After a few minutes Backstage should be up and running in your cluster under the +DNS specified earlier. + +Make sure to create the appropriate DNS entry in your infrastructure. To find +the public IP address run: + +```bash +$ kubectl get ingress +NAME HOSTS ADDRESS PORTS AGE +backstage-ingress * 123.1.2.3 80 17m +``` + +> **NOTE**: this is not a production ready deployment. + +For more information on how to customize the deployment check the +[README][charts-readme]. + +[backstage-helm-charts]: + (https://github.com/spotify/backstage/tree/master/contrib/chart/backstage) +[charts-readme]: + (https://github.com/spotify/backstage/tree/master/contrib/chart/backstage/README.md) From 797ac6a450f386d2f80b3f942f19eeef301b9323 Mon Sep 17 00:00:00 2001 From: Martina Iglesias Fernandez Date: Thu, 8 Oct 2020 15:28:58 +0200 Subject: [PATCH 18/24] Use app-config.development.yaml to provide configuration instead of local The app-config.yaml file that comes inside the docker image for the backend contains configuration for the key `scaffolder.azure`. This automatically enables the use of azure and it is not possible to set its values to dummy ones because it will fail when it tries to validate them. To avoid the backend throwing an exception for this, the charts are using the "development" mode (via setting NODE_ENV=development). This means that the app-config.development.yaml file that ships in the container woud have higher precedence than the app-config.local.yaml file that the charts tried to create before. For that reason, for now, they will override the development file. A better solution would be to ship the docker images with a minimal app-config.yaml or even without any config. And then have these charts provide said file. --- ...ocal.yaml.tpl => app-config.development.yaml.tpl} | 12 ++++++++---- contrib/chart/backstage/templates/_helpers.tpl | 2 +- .../backstage/templates/backstage-app-config.yaml | 2 +- 3 files changed, 10 insertions(+), 6 deletions(-) rename contrib/chart/backstage/files/{app-config.local.yaml.tpl => app-config.development.yaml.tpl} (97%) diff --git a/contrib/chart/backstage/files/app-config.local.yaml.tpl b/contrib/chart/backstage/files/app-config.development.yaml.tpl similarity index 97% rename from contrib/chart/backstage/files/app-config.local.yaml.tpl rename to contrib/chart/backstage/files/app-config.development.yaml.tpl index 646d438771..76d6499145 100644 --- a/contrib/chart/backstage/files/app-config.local.yaml.tpl +++ b/contrib/chart/backstage/files/app-config.development.yaml.tpl @@ -35,12 +35,16 @@ catalog: locations: [] {{- end }} -sentry: - organization: {{ .Values.appConfig.sentry.organization | quote }} +auth: + providers: + microsoft: null scaffolder: - azure: - baseUrl: https://dev.azure.com/some-org + azure: null + + +sentry: + organization: {{ .Values.appConfig.sentry.organization | quote }} techdocs: generators: diff --git a/contrib/chart/backstage/templates/_helpers.tpl b/contrib/chart/backstage/templates/_helpers.tpl index ec54c91d1b..5d49ba6975 100644 --- a/contrib/chart/backstage/templates/_helpers.tpl +++ b/contrib/chart/backstage/templates/_helpers.tpl @@ -282,5 +282,5 @@ Postgres password for lighthouse app-config file name */}} {{- define "backstage.appConfigFilename" -}} -{{- "app-config.local.yaml" -}} +{{- "app-config.development.yaml" -}} {{- end -}} diff --git a/contrib/chart/backstage/templates/backstage-app-config.yaml b/contrib/chart/backstage/templates/backstage-app-config.yaml index 987ad8e160..061fc3285b 100644 --- a/contrib/chart/backstage/templates/backstage-app-config.yaml +++ b/contrib/chart/backstage/templates/backstage-app-config.yaml @@ -4,7 +4,7 @@ metadata: name: {{ include "backstage.fullname" . }}-app-config data: {{ include "backstage.appConfigFilename" . | indent 2 }}: | -{{ tpl (.Files.Get "files/app-config.local.yaml.tpl") . | indent 4 }} +{{ tpl (.Files.Get "files/app-config.development.yaml.tpl") . | indent 4 }} --- apiVersion: v1 kind: ConfigMap From 84e6d0e2305a7bdb23f2b8bbd200b3a984c46d3d Mon Sep 17 00:00:00 2001 From: Martina Iglesias Fernandez Date: Thu, 8 Oct 2020 15:58:19 +0200 Subject: [PATCH 19/24] Remove line in initdb script that creates backend db Since this is already created by the backend --- contrib/chart/backstage/files/create-backend-dbs.sql | 1 - 1 file changed, 1 deletion(-) diff --git a/contrib/chart/backstage/files/create-backend-dbs.sql b/contrib/chart/backstage/files/create-backend-dbs.sql index 7902b15b6d..043ff7daf5 100644 --- a/contrib/chart/backstage/files/create-backend-dbs.sql +++ b/contrib/chart/backstage/files/create-backend-dbs.sql @@ -2,7 +2,6 @@ {{ $lighthouseDb := .Values.lighthouse.database.connection.database }} {{ $user := .Values.global.postgresql.postgresqlUsername }} -create database {{ $backendDb }}; grant all privileges on database {{ $backendDb }} to {{ $user }}; create database backstage_plugin_auth; From dd5be710f523ec165ad7b80fe9ccf06fff086724 Mon Sep 17 00:00:00 2001 From: Martina Iglesias Fernandez Date: Thu, 8 Oct 2020 17:04:58 +0200 Subject: [PATCH 20/24] Move the k8s deployment docs to its own helm deployment page --- docs/getting-started/deployment-helm.md | 68 +++++++++++++++++++++++++ docs/getting-started/deployment-k8s.md | 63 +---------------------- 2 files changed, 69 insertions(+), 62 deletions(-) create mode 100644 docs/getting-started/deployment-helm.md diff --git a/docs/getting-started/deployment-helm.md b/docs/getting-started/deployment-helm.md new file mode 100644 index 0000000000..dc8430e95e --- /dev/null +++ b/docs/getting-started/deployment-helm.md @@ -0,0 +1,68 @@ +--- +id: deployment-helm +title: Helm +description: Documentation on Kubernetes and Helm Deployment +--- + +# Helm charts + +An example Backstage app can be deployed in Kubernetes using the [Backstage Helm +charts][backstage-helm-charts] + +First, choose a DNS name where backstage will be hosted create a yaml file for +your custom configuration. + +``` +appConfig: + app: + baseUrl: https://backstage.mydomain.com + title: Backstage + backend: + baseUrl: https://backstage.mydomain.com + cors: + origin: https://backstage.mydomain.com + lighthouse: + baseUrl: https://backstage.mydomain.com/lighthouse-api + techdocs: + storageUrl: https://backstage.mydomain.com/api/techdocs/static/docs + requestUrl: https://backstage.mydomain.com/api/techdocs + +``` + +Then use it to run: + +``` +git clone https://github.com/spotify/backstage.git +cd contrib/chart/backstage +helm install -f backstage-mydomain.yaml backstage . +``` + +This command will deploy the following pieces: + +- Backstage frontend +- Backstage backend with scaffolder and auth plugins +- (optional) a PostgreSQL instance +- lighthouse plugin +- ingress + +After a few minutes Backstage should be up and running in your cluster under the +DNS specified earlier. + +Make sure to create the appropriate DNS entry in your infrastructure. To find +the public IP address run: + +```bash +$ kubectl get ingress +NAME HOSTS ADDRESS PORTS AGE +backstage-ingress * 123.1.2.3 80 17m +``` + +> **NOTE**: this is not a production ready deployment. + +For more information on how to customize the deployment check the +[README][charts-readme]. + +[backstage-helm-charts]: + (https://github.com/spotify/backstage/tree/master/contrib/chart/backstage) +[charts-readme]: + (https://github.com/spotify/backstage/tree/master/contrib/chart/backstage/README.md) diff --git a/docs/getting-started/deployment-k8s.md b/docs/getting-started/deployment-k8s.md index c2682d85a4..ddcbd290c6 100644 --- a/docs/getting-started/deployment-k8s.md +++ b/docs/getting-started/deployment-k8s.md @@ -4,65 +4,4 @@ title: Kubernetes description: Documentation on Kubernetes and K8s Deployment --- -# Helm charts - -An example Backstage app can be deployed in Kubernetes using the [Backstage Helm -charts][backstage-helm-charts] - -First, choose a DNS name where backstage will be hosted create a yaml file for -your custom configuration. - -``` -appConfig: - app: - baseUrl: https://backstage.mydomain.com - title: Backstage - backend: - baseUrl: https://backstage.mydomain.com - cors: - origin: https://backstage.mydomain.com - lighthouse: - baseUrl: https://backstage.mydomain.com/lighthouse-api - techdocs: - storageUrl: https://backstage.mydomain.com/api/techdocs/static/docs - requestUrl: https://backstage.mydomain.com/api/techdocs - -``` - -Then use it to run: - -``` -git clone https://github.com/spotify/backstage.git -cd contrib/chart/backstage -helm install -f backstage-mydomain.yaml backstage . -``` - -This command will deploy the following pieces: - -- Backstage frontend -- Backstage backend with scaffolder and auth plugins -- (optional) a PostgreSQL instance -- lighthouse plugin -- ingress - -After a few minutes Backstage should be up and running in your cluster under the -DNS specified earlier. - -Make sure to create the appropriate DNS entry in your infrastructure. To find -the public IP address run: - -```bash -$ kubectl get ingress -NAME HOSTS ADDRESS PORTS AGE -backstage-ingress * 123.1.2.3 80 17m -``` - -> **NOTE**: this is not a production ready deployment. - -For more information on how to customize the deployment check the -[README][charts-readme]. - -[backstage-helm-charts]: - (https://github.com/spotify/backstage/tree/master/contrib/chart/backstage) -[charts-readme]: - (https://github.com/spotify/backstage/tree/master/contrib/chart/backstage/README.md) +Coming soon! From 001fd7c57ad739ce3c0a2ac78300103f033af9d4 Mon Sep 17 00:00:00 2001 From: Martina Iglesias Fernandez Date: Fri, 9 Oct 2020 08:31:05 +0200 Subject: [PATCH 21/24] Only lint charts on Pull Requests --- .github/workflows/charts-lint-test.yaml | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/.github/workflows/charts-lint-test.yaml b/.github/workflows/charts-lint-test.yaml index ab73407e9d..032f70f96f 100644 --- a/.github/workflows/charts-lint-test.yaml +++ b/.github/workflows/charts-lint-test.yaml @@ -18,15 +18,3 @@ jobs: with: command: lint config: ct.yaml - - - name: Create kind cluster - uses: helm/kind-action@v1.0.0 - # Only build a kind cluster if there are chart changes to test. - if: steps.lint.outputs.changed == 'true' - - - name: Install charts - uses: helm/chart-testing-action@v1.1.0 - if: steps.lint.outputs.changed == 'true' - with: - command: install - config: ct.yaml From 22848a96fde8e1fb7008bfc9982e1030b172c3ad Mon Sep 17 00:00:00 2001 From: Martina Iglesias Fernandez Date: Fri, 9 Oct 2020 12:16:33 +0200 Subject: [PATCH 22/24] Remove chart testing workflow for now --- .github/workflows/charts-lint-test.yaml | 20 ------------ chart_schema.yaml | 37 ---------------------- ct.yaml | 8 ----- lintconf.yaml | 42 ------------------------- 4 files changed, 107 deletions(-) delete mode 100644 .github/workflows/charts-lint-test.yaml delete mode 100644 chart_schema.yaml delete mode 100644 ct.yaml delete mode 100644 lintconf.yaml diff --git a/.github/workflows/charts-lint-test.yaml b/.github/workflows/charts-lint-test.yaml deleted file mode 100644 index 032f70f96f..0000000000 --- a/.github/workflows/charts-lint-test.yaml +++ /dev/null @@ -1,20 +0,0 @@ -name: Lint and Test Charts - -on: pull_request - -jobs: - lint-test: - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v2 - - - name: Fetch history - run: git fetch --prune --unshallow - - - name: Run chart-testing (lint) - id: lint - uses: helm/chart-testing-action@v1.1.0 - with: - command: lint - config: ct.yaml diff --git a/chart_schema.yaml b/chart_schema.yaml deleted file mode 100644 index 61fc3e14b2..0000000000 --- a/chart_schema.yaml +++ /dev/null @@ -1,37 +0,0 @@ -name: str() -home: str(required=False) -version: str() -apiVersion: str() -appVersion: any(str(), num(), required=False) -description: str() -keywords: list(str(), required=False) -sources: list(str(), required=False) -maintainers: list(include('maintainer'), required=False) -dependencies: list(include('dependency'), required=False) -icon: str(required=False) -engine: str(required=False) -condition: str(required=False) -tags: str(required=False) -deprecated: bool(required=False) -kubeVersion: str(required=False) -annotations: map(str(), str(), required=False) -type: str(required=False) ---- -maintainer: - name: str() - email: str(required=False) - url: str(required=False) ---- -dependency: - name: str() - version: str() - repository: str() - condition: str(required=False) - tags: list(str(), required=False) - enabled: bool(required=False) - import-values: any(list(str()), list(include('import-value')), required=False) - alias: str(required=False) ---- -import-value: - child: str() - parent: str() diff --git a/ct.yaml b/ct.yaml deleted file mode 100644 index 53a47c95c2..0000000000 --- a/ct.yaml +++ /dev/null @@ -1,8 +0,0 @@ -charts: - - contrib/chart/backstage - -validate-maintainers: false -debug: true -target-branch: master -chart-repos: - - bitnami=https://charts.bitnami.com/bitnami diff --git a/lintconf.yaml b/lintconf.yaml deleted file mode 100644 index b9eb34ff2d..0000000000 --- a/lintconf.yaml +++ /dev/null @@ -1,42 +0,0 @@ ---- -rules: - braces: - min-spaces-inside: 0 - max-spaces-inside: 0 - min-spaces-inside-empty: -1 - max-spaces-inside-empty: -1 - brackets: - min-spaces-inside: 0 - max-spaces-inside: 0 - min-spaces-inside-empty: -1 - max-spaces-inside-empty: -1 - colons: - max-spaces-before: 0 - max-spaces-after: 1 - commas: - max-spaces-before: 0 - min-spaces-after: 1 - max-spaces-after: 1 - comments: - require-starting-space: true - min-spaces-from-content: 2 - document-end: disable - document-start: disable # No --- to start a file - empty-lines: - max: 2 - max-start: 0 - max-end: 0 - hyphens: - max-spaces-after: 1 - indentation: - spaces: consistent - indent-sequences: whatever # - list indentation will handle both indentation and without - check-multi-line-strings: false - key-duplicates: enable - line-length: disable # Lines can be any length - new-line-at-end-of-file: enable - new-lines: - type: unix - trailing-spaces: enable - truthy: - level: warning From cafe45b4a90bcdf8aa6804c9a7a443ce535ff70f Mon Sep 17 00:00:00 2001 From: Martina Iglesias Fernandez Date: Mon, 12 Oct 2020 09:24:04 +0200 Subject: [PATCH 23/24] Fix feedback from dtuite --- contrib/chart/backstage/README.md | 3 ++- docs/getting-started/deployment-helm.md | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/contrib/chart/backstage/README.md b/contrib/chart/backstage/README.md index 1a045e09ca..4f247252b1 100644 --- a/contrib/chart/backstage/README.md +++ b/contrib/chart/backstage/README.md @@ -38,6 +38,7 @@ Then use it to run: ``` git clone https://github.com/spotify/backstage.git cd contrib/chart/backstage +helm dependency update helm install -f backstage-mydomain.yaml backstage . ``` @@ -135,7 +136,7 @@ backend: repository: tag: -frontend: +lighthouse: image: repository: diff --git a/docs/getting-started/deployment-helm.md b/docs/getting-started/deployment-helm.md index dc8430e95e..bc239d9306 100644 --- a/docs/getting-started/deployment-helm.md +++ b/docs/getting-started/deployment-helm.md @@ -34,6 +34,7 @@ Then use it to run: ``` git clone https://github.com/spotify/backstage.git cd contrib/chart/backstage +helm dependency update helm install -f backstage-mydomain.yaml backstage . ``` From 9c27e58c03a3f492fc54d8070061564b1e24e764 Mon Sep 17 00:00:00 2001 From: Martina Iglesias Fernandez Date: Mon, 12 Oct 2020 09:56:28 +0200 Subject: [PATCH 24/24] Update name of env authentication env vars --- contrib/chart/backstage/templates/backend-secret.yaml | 6 +++--- contrib/chart/backstage/values.yaml | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/contrib/chart/backstage/templates/backend-secret.yaml b/contrib/chart/backstage/templates/backend-secret.yaml index ab8fff00ec..63eddc2742 100644 --- a/contrib/chart/backstage/templates/backend-secret.yaml +++ b/contrib/chart/backstage/templates/backend-secret.yaml @@ -15,7 +15,7 @@ stringData: SENTRY_TOKEN: {{ .Values.auth.sentryToken }} ROLLBAR_ACCOUNT_TOKEN: {{ .Values.auth.rollbarAccountToken }} CIRCLECI_AUTH_TOKEN: {{ .Values.auth.circleciAuthToken }} - GITHUB_ACCESS_TOKEN: {{ .Values.auth.githubAccessToken }} - GITLAB_ACCESS_TOKEN: {{ .Values.auth.gitlabAccessToken }} - AZURE_PRIVATE_TOKEN: {{ .Values.auth.azure.api.token }} + GITHUB_TOKEN: {{ .Values.auth.githubToken }} + GITLAB_TOKEN: {{ .Values.auth.gitlabToken }} + AZURE_TOKEN: {{ .Values.auth.azure.api.token }} {{- end }} diff --git a/contrib/chart/backstage/values.yaml b/contrib/chart/backstage/values.yaml index e307701249..3ce45c5330 100644 --- a/contrib/chart/backstage/values.yaml +++ b/contrib/chart/backstage/values.yaml @@ -241,5 +241,5 @@ auth: # This is a 'Personal Access Token' circleciAuthToken: r # Used by the scaffolder to create GitHub repos. Must have 'repo' scope. - githubAccessToken: g - gitlabAccessToken: g + githubToken: g + gitlabToken: g