Enable deploying feature branches into isolated environments on the same k3s cluster. Each branch gets its own namespace (cam-<slug>), PostgreSQL schema, and OpenSearch index prefix for data isolation while sharing the underlying infrastructure. - Make OpenSearch index prefix and DB schema configurable via env vars (defaults preserve existing behavior) - Restructure deploy/ into Kustomize base + overlays (main/feature) - Extend CI to build Docker images for all branches, not just main - Add deploy-feature job with namespace creation, secret copying, Traefik Ingress routing (<slug>-api/ui.cameleer.siegeln.net) - Add cleanup-branch job to remove namespace, PG schema, OS indices on branch deletion - Install required tools (git, jq, curl) in CI deploy containers Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
31 lines
851 B
YAML
31 lines
851 B
YAML
apiVersion: batch/v1
|
|
kind: Job
|
|
metadata:
|
|
name: init-schema
|
|
spec:
|
|
template:
|
|
spec:
|
|
restartPolicy: Never
|
|
containers:
|
|
- name: init
|
|
image: postgres:16
|
|
command: ["sh", "-c"]
|
|
args:
|
|
- |
|
|
PGPASSWORD=$POSTGRES_PASSWORD psql \
|
|
-h postgres.cameleer.svc.cluster.local \
|
|
-U $POSTGRES_USER -d cameleer3 \
|
|
-c "CREATE SCHEMA IF NOT EXISTS BRANCH_SCHEMA"
|
|
env:
|
|
- name: POSTGRES_USER
|
|
valueFrom:
|
|
secretKeyRef:
|
|
name: postgres-credentials
|
|
key: POSTGRES_USER
|
|
- name: POSTGRES_PASSWORD
|
|
valueFrom:
|
|
secretKeyRef:
|
|
name: postgres-credentials
|
|
key: POSTGRES_PASSWORD
|
|
backoffLimit: 3
|