Skip to content

Commit d353774

Browse files
committed
feat: add kustomize deployment bundle for Backstage
Add the config/ tree that is published as the backstage-kustomize OCI bundle and consumed by the e2e gate. Key changes: - config/base: namespace, service account, ClusterIP service on 7007, and a Deployment running the backend image with readiness/liveness probes on the new-backend health endpoints (/.backstage/health/v1/readiness and /.backstage/health/v1/liveness). The kustomization carries an images entry for ghcr.io/datum-cloud/backstage so the bundle publisher can pin the built tag. - config/test: e2e overlay that boots Backstage without GCP secrets or SSO. Adds an ephemeral postgres:16-alpine, an app-config.e2e.yaml ConfigMap (guest auth, default auth policy disabled, pg database, github integrations/providers removed, a small static example catalog), and a Deployment patch wiring the DB env and config mount. The image is pinned to backstage:e2e so kind uses the locally loaded image. Claude-Session: https://claude.ai/code/session_01NMSkwUcaTmZr7S5XmV2aFG
1 parent 43f9ed8 commit d353774

11 files changed

Lines changed: 262 additions & 0 deletions

config/base/deployment.yaml

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
apiVersion: apps/v1
2+
kind: Deployment
3+
metadata:
4+
name: backstage
5+
namespace: backstage
6+
labels:
7+
app.kubernetes.io/name: backstage
8+
spec:
9+
replicas: 1
10+
selector:
11+
matchLabels:
12+
app.kubernetes.io/name: backstage
13+
template:
14+
metadata:
15+
labels:
16+
app.kubernetes.io/name: backstage
17+
spec:
18+
serviceAccountName: backstage
19+
containers:
20+
- name: backstage
21+
image: ghcr.io/datum-cloud/backstage
22+
imagePullPolicy: IfNotPresent
23+
ports:
24+
- name: http
25+
containerPort: 7007
26+
protocol: TCP
27+
readinessProbe:
28+
httpGet:
29+
path: /.backstage/health/v1/readiness
30+
port: http
31+
initialDelaySeconds: 15
32+
periodSeconds: 10
33+
timeoutSeconds: 5
34+
failureThreshold: 6
35+
livenessProbe:
36+
httpGet:
37+
path: /.backstage/health/v1/liveness
38+
port: http
39+
initialDelaySeconds: 60
40+
periodSeconds: 30
41+
timeoutSeconds: 5
42+
failureThreshold: 3
43+
resources:
44+
requests:
45+
cpu: 500m
46+
memory: 512Mi
47+
limits:
48+
memory: 1Gi

config/base/kustomization.yaml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
apiVersion: kustomize.config.k8s.io/v1beta1
2+
kind: Kustomization
3+
4+
resources:
5+
- namespace.yaml
6+
- serviceaccount.yaml
7+
- service.yaml
8+
- deployment.yaml
9+
10+
images:
11+
- name: ghcr.io/datum-cloud/backstage

config/base/namespace.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
apiVersion: v1
2+
kind: Namespace
3+
metadata:
4+
name: backstage

config/base/service.yaml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
apiVersion: v1
2+
kind: Service
3+
metadata:
4+
name: backstage
5+
namespace: backstage
6+
labels:
7+
app.kubernetes.io/name: backstage
8+
spec:
9+
type: ClusterIP
10+
selector:
11+
app.kubernetes.io/name: backstage
12+
ports:
13+
- name: http
14+
port: 7007
15+
targetPort: http
16+
protocol: TCP

config/base/serviceaccount.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
apiVersion: v1
2+
kind: ServiceAccount
3+
metadata:
4+
name: backstage
5+
namespace: backstage

config/test/app-config-e2e.yaml

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
apiVersion: v1
2+
kind: ConfigMap
3+
metadata:
4+
name: backstage-app-config-e2e
5+
namespace: backstage
6+
data:
7+
app-config.e2e.yaml: |
8+
app:
9+
baseUrl: http://localhost:7007
10+
11+
backend:
12+
baseUrl: http://localhost:7007
13+
listen:
14+
port: 7007
15+
host: 0.0.0.0
16+
csp:
17+
connect-src: ["'self'", 'http:', 'https:']
18+
cors:
19+
origin: http://localhost:7007
20+
methods: [GET, HEAD, PATCH, POST, PUT, DELETE]
21+
credentials: true
22+
database:
23+
client: pg
24+
connection:
25+
host: ${POSTGRES_HOST}
26+
port: ${POSTGRES_PORT}
27+
user: ${POSTGRES_USER}
28+
password: ${POSTGRES_PASSWORD}
29+
auth:
30+
dangerouslyDisableDefaultAuthPolicy: true
31+
32+
auth:
33+
providers:
34+
guest:
35+
dangerouslyAllowOutsideDevelopment: true
36+
37+
integrations: {}
38+
39+
catalog:
40+
providers: {}
41+
locations:
42+
- type: file
43+
target: /app/examples/entities.yaml
44+
- type: file
45+
target: /app/examples/org.yaml
46+
rules:
47+
- allow: [User, Group]

config/test/deployment-patch.yaml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
apiVersion: apps/v1
2+
kind: Deployment
3+
metadata:
4+
name: backstage
5+
namespace: backstage
6+
spec:
7+
template:
8+
spec:
9+
containers:
10+
- name: backstage
11+
args:
12+
- "node"
13+
- "packages/backend"
14+
- "--config"
15+
- "app-config.yaml"
16+
- "--config"
17+
- "/etc/backstage/app-config.e2e.yaml"
18+
env:
19+
- name: POSTGRES_HOST
20+
value: postgres
21+
- name: POSTGRES_PORT
22+
value: "5432"
23+
- name: POSTGRES_USER
24+
valueFrom:
25+
secretKeyRef:
26+
name: backstage-postgres
27+
key: POSTGRES_USER
28+
- name: POSTGRES_PASSWORD
29+
valueFrom:
30+
secretKeyRef:
31+
name: backstage-postgres
32+
key: POSTGRES_PASSWORD
33+
volumeMounts:
34+
- name: app-config-e2e
35+
mountPath: /etc/backstage
36+
readOnly: true
37+
volumes:
38+
- name: app-config-e2e
39+
configMap:
40+
name: backstage-app-config-e2e

config/test/kustomization.yaml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
apiVersion: kustomize.config.k8s.io/v1beta1
2+
kind: Kustomization
3+
4+
namespace: backstage
5+
6+
resources:
7+
- ../base
8+
- postgres-secret.yaml
9+
- postgres-deployment.yaml
10+
- postgres-service.yaml
11+
- app-config-e2e.yaml
12+
13+
images:
14+
- name: ghcr.io/datum-cloud/backstage
15+
newName: backstage
16+
newTag: e2e
17+
18+
patches:
19+
- path: deployment-patch.yaml
20+
target:
21+
kind: Deployment
22+
name: backstage
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
apiVersion: apps/v1
2+
kind: Deployment
3+
metadata:
4+
name: postgres
5+
namespace: backstage
6+
labels:
7+
app.kubernetes.io/name: postgres
8+
spec:
9+
replicas: 1
10+
selector:
11+
matchLabels:
12+
app.kubernetes.io/name: postgres
13+
template:
14+
metadata:
15+
labels:
16+
app.kubernetes.io/name: postgres
17+
spec:
18+
containers:
19+
- name: postgres
20+
image: postgres:16-alpine
21+
ports:
22+
- name: postgres
23+
containerPort: 5432
24+
envFrom:
25+
- secretRef:
26+
name: backstage-postgres
27+
env:
28+
- name: PGDATA
29+
value: /var/lib/postgresql/data/pgdata
30+
readinessProbe:
31+
exec:
32+
command: ["pg_isready", "-U", "backstage"]
33+
initialDelaySeconds: 5
34+
periodSeconds: 5
35+
volumeMounts:
36+
- name: data
37+
mountPath: /var/lib/postgresql/data
38+
resources:
39+
requests:
40+
cpu: 100m
41+
memory: 128Mi
42+
volumes:
43+
- name: data
44+
emptyDir: {}

config/test/postgres-secret.yaml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
apiVersion: v1
2+
kind: Secret
3+
metadata:
4+
name: backstage-postgres
5+
namespace: backstage
6+
type: Opaque
7+
stringData:
8+
POSTGRES_USER: backstage
9+
POSTGRES_PASSWORD: backstage
10+
POSTGRES_DB: backstage

0 commit comments

Comments
 (0)