Created
March 20, 2024 09:14
-
-
Save rm3l/01d80e728d6ae38bc75a0869247320dd to your computer and use it in GitHub Desktop.
RHDH CR with oauth2-proxy sidecar container
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
apiVersion: rhdh.redhat.com/v1alpha1 | |
kind: Backstage | |
metadata: | |
name: backstage-with-sidecar | |
spec: | |
# TODO: you may want to add app-config files, dynamic plugins config, extra env vars, etc. in the 'application' field. | |
# application: {} | |
rawRuntimeConfig: | |
backstageConfig: backstage-with-sidecar-runtime-config | |
--- | |
apiVersion: v1 | |
kind: Secret | |
metadata: | |
name: backstage-with-sidecar-app-secrets | |
stringData: | |
OAUTH2_PROXY_CLIENT_ID: "my-oauth2-proxy-client-id" | |
OAUTH2_PROXY_CLIENT_SECRET: "my-oauth2-proxy-client-secret" | |
OAUTH2_PROXY_COOKIE_SECRET: "my-oauth2-proxy-cookie-secret" | |
OAUTH2_PROXY_OIDC_ISSUER_URL: "my-oauth2-proxy-oidc-issuer-url" | |
OAUTH2_PROXY_SSL_INSECURE_SKIP_VERIFY: "true" | |
--- | |
apiVersion: v1 | |
kind: ConfigMap | |
metadata: | |
name: backstage-with-sidecar-runtime-config | |
data: | |
deployment.yaml: |- | |
apiVersion: apps/v1 | |
kind: Deployment | |
#metadata: | |
# name: # placeholder for 'backstage-<cr-name>' | |
spec: | |
#replicas: 1 | |
selector: | |
matchLabels: | |
rhdh.redhat.com/app: # placeholder for 'backstage-<cr-name>' | |
template: | |
metadata: | |
labels: | |
rhdh.redhat.com/app: # placeholder for 'backstage-<cr-name>' | |
spec: | |
automountServiceAccountToken: false | |
volumes: | |
- ephemeral: | |
volumeClaimTemplate: | |
spec: | |
accessModes: | |
- ReadWriteOnce | |
resources: | |
requests: | |
storage: 2Gi | |
name: dynamic-plugins-root | |
- name: dynamic-plugins-npmrc | |
secret: | |
defaultMode: 420 | |
optional: true | |
secretName: dynamic-plugins-npmrc | |
initContainers: | |
- command: | |
- ./install-dynamic-plugins.sh | |
- /dynamic-plugins-root | |
env: | |
- name: NPM_CONFIG_USERCONFIG | |
value: /opt/app-root/src/.npmrc.dynamic-plugins | |
# image will be replaced by the value of the `RELATED_IMAGE_backstage` env var, if set | |
image: quay.io/janus-idp/backstage-showcase:latest | |
imagePullPolicy: IfNotPresent | |
name: install-dynamic-plugins | |
volumeMounts: | |
- mountPath: /dynamic-plugins-root | |
name: dynamic-plugins-root | |
- mountPath: /opt/app-root/src/.npmrc.dynamic-plugins | |
name: dynamic-plugins-npmrc | |
readOnly: true | |
subPath: .npmrc | |
workingDir: /opt/app-root/src | |
resources: | |
limits: | |
cpu: 1000m | |
memory: 2.5Gi | |
ephemeral-storage: 5Gi | |
containers: | |
- name: backstage-backend | |
# image will be replaced by the value of the `RELATED_IMAGE_backstage` env var, if set | |
image: quay.io/janus-idp/backstage-showcase:latest | |
imagePullPolicy: IfNotPresent | |
args: | |
- "--config" | |
- "dynamic-plugins-root/app-config.dynamic-plugins.yaml" | |
readinessProbe: | |
failureThreshold: 3 | |
httpGet: | |
path: /healthcheck | |
port: 7007 | |
scheme: HTTP | |
initialDelaySeconds: 30 | |
periodSeconds: 10 | |
successThreshold: 2 | |
timeoutSeconds: 2 | |
livenessProbe: | |
failureThreshold: 3 | |
httpGet: | |
path: /healthcheck | |
port: 7007 | |
scheme: HTTP | |
initialDelaySeconds: 60 | |
periodSeconds: 10 | |
successThreshold: 1 | |
timeoutSeconds: 2 | |
ports: | |
- name: backend | |
containerPort: 7007 | |
env: | |
- name: APP_CONFIG_backend_listen_port | |
value: "7007" | |
envFrom: | |
- secretRef: | |
name: <POSTGRESQL_SECRET> # will be replaced with 'backstage-psql-secrets-<cr-name>' | |
# - secretRef: | |
# name: backstage-secrets | |
volumeMounts: | |
- mountPath: /opt/app-root/src/dynamic-plugins-root | |
name: dynamic-plugins-root | |
resources: | |
limits: | |
cpu: 1000m | |
memory: 2.5Gi | |
ephemeral-storage: 5Gi | |
# oauth2 sidecar container | |
- args: | |
- '--provider=oidc' | |
- '--email-domain=*' | |
- '--upstream=http://localhost:7007' | |
- '--http-address=0.0.0.0:4180' | |
- '--skip-provider-button' | |
- '--insecure-oidc-allow-unverified-email=true' | |
- '--pass-access-token=true' | |
- '--pass-user-headers=true' | |
envFrom: | |
- secretRef: | |
name: backstage-with-sidecar-app-secrets | |
image: 'quay.io/oauth2-proxy/oauth2-proxy:latest' | |
imagePullPolicy: IfNotPresent | |
name: oauth2-proxy | |
ports: | |
- containerPort: 4180 | |
name: oauth2-proxy | |
protocol: TCP |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment