Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
25a16b9
feat: migrate manifests from Ingress to Gateway API (HTTPRoute)
TineoC Mar 21, 2026
1ea8894
feat: configure HTTPRoute for sandbox.balancerproject.org
TineoC Mar 21, 2026
1484428
feat: add sandbox and production overlays for HTTPRoute
TineoC Mar 21, 2026
6f50887
cleanup: remove unused dev overlay
TineoC Mar 21, 2026
4cbb380
feat(gateway): implement self-service TLS via ListenerSet
TineoC Apr 18, 2026
cc3fbe9
fix(gateway): update overlays to patch ListenerSet hostnames
TineoC Apr 18, 2026
b9c9591
feat(gateway): implement HTTP to HTTPS redirect via ListenerSet
TineoC Apr 18, 2026
fb7b270
fix(gateway): patch hostname for redirect HTTPRoute in overlays
TineoC Apr 18, 2026
b1e4918
Configure CORS Allowed Origins via ConfigMaps
TineoC Apr 18, 2026
00250ef
Update sandbox domain for CORS
TineoC Apr 18, 2026
8262de5
Refine ConfigMap overlays using env files and correct sandbox domain
TineoC Apr 18, 2026
d97f0c9
feat: add balancer database cluster manifest
TineoC Apr 18, 2026
92fd46d
remove redundant cluster manifest (moved to infra repo)
TineoC Apr 18, 2026
cf324fb
remove db.yaml from kustomization resources
TineoC Apr 18, 2026
c6f001d
feat: add sandbox overlay with shared db connection details
TineoC Apr 18, 2026
76af69f
feat: update sandbox overlay to use shared db password from secret
TineoC Apr 18, 2026
e48e52d
feat: add configmap for database settings in sandbox overlay
TineoC Apr 18, 2026
d725fe0
feat: update kustomization to use configmap and secret for db settings
TineoC Apr 18, 2026
99523c9
feat: move database manifest to base and update SQL_HOST for shared-c…
TineoC May 1, 2026
98ec6b4
Merge branch 'pr-482' into integrate-all-migration
TineoC May 7, 2026
7ab8480
Merge branch 'pr-500' into integrate-all-migration
TineoC May 7, 2026
920e0cd
Merge branch 'pr-501' into integrate-all-migration
TineoC May 7, 2026
06359c5
fix: remove redundant namespace patch on database.yaml
TineoC May 7, 2026
1af2d30
fix: move Database CRD to cfp-sandbox-cluster infra
TineoC May 7, 2026
e8bfa66
fix: move Database CRD to sandbox-only CNPG kustomization
TineoC May 7, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Empty file.
2 changes: 2 additions & 0 deletions deploy/manifests/balancer/base/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ spec:
envFrom:
- secretRef:
name: balancer-config
- configMapRef:
name: balancer-config
ports:
- containerPort: 8000
readinessProbe:
Expand Down
26 changes: 26 additions & 0 deletions deploy/manifests/balancer/base/gateway-listeners.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
apiVersion: gateway.networking.k8s.io/v1
kind: ListenerSet
metadata:
name: balancer-listeners
annotations:
cert-manager.io/cluster-issuer: letsencrypt-prod
spec:
parentRef:
name: main-gateway
namespace: envoy-gateway-system
group: gateway.networking.k8s.io
kind: Gateway
listeners:
- name: http
protocol: HTTP
port: 80
hostname: HOSTNAME_PLACEHOLDER
- name: https
protocol: HTTPS
port: 443
hostname: HOSTNAME_PLACEHOLDER
tls:
mode: Terminate
certificateRefs:
- name: balancer-tls
kind: Secret
39 changes: 39 additions & 0 deletions deploy/manifests/balancer/base/httproute.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
apiVersion: gateway.networking.k8s.io/v1
kind: HTTPRoute
metadata:
name: balancer-redirect
spec:
parentRefs:
- name: balancer-listeners
kind: ListenerSet
group: gateway.networking.k8s.io
sectionName: http
hostnames:
- HOSTNAME_PLACEHOLDER
rules:
- filters:
- type: RequestRedirect
requestRedirect:
scheme: https
statusCode: 301
---
apiVersion: gateway.networking.k8s.io/v1
kind: HTTPRoute
metadata:
name: balancer
spec:
parentRefs:
- name: balancer-listeners
kind: ListenerSet
group: gateway.networking.k8s.io
sectionName: https
hostnames:
- HOSTNAME_PLACEHOLDER
rules:
- matches:
- path:
type: PathPrefix
value: /
backendRefs:
- name: balancer
port: 80
23 changes: 0 additions & 23 deletions deploy/manifests/balancer/base/ingress.yaml

This file was deleted.

8 changes: 7 additions & 1 deletion deploy/manifests/balancer/base/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,10 @@ resources:
- namespace.yaml
- deployment.yaml
- service.yaml
- ingress.yaml
- gateway-listeners.yaml
- httproute.yaml

configMapGenerator:
- name: balancer-config
envs:
- balancer.env
2 changes: 1 addition & 1 deletion deploy/manifests/balancer/base/service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ metadata:
spec:
ports:
- name: http
port: 8000
port: 80
targetPort: 8000
selector:
app: balancer
26 changes: 0 additions & 26 deletions deploy/manifests/balancer/overlays/dev/kustomization.yaml

This file was deleted.

1 change: 1 addition & 0 deletions deploy/manifests/balancer/overlays/production/balancer.env
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
CORS_ALLOWED_ORIGINS=https://balancerproject.org
43 changes: 43 additions & 0 deletions deploy/manifests/balancer/overlays/production/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization

namespace: balancer

resources:
- ../../base

images:
- name: ghcr.io/codeforphilly/balancer-main/app
newTag: latest

configMapGenerator:
- name: balancer-config
behavior: merge
envs:
- balancer.env

patches:
- target:
kind: ListenerSet
name: balancer-listeners
patch: |-
- op: replace
path: /spec/listeners/0/hostname
value: balancerproject.org
- op: replace
path: /spec/listeners/1/hostname
value: balancerproject.org
- target:
kind: HTTPRoute
name: balancer
patch: |-
- op: add
path: /spec/hostnames
value: ["balancerproject.org"]
- target:
kind: HTTPRoute
name: balancer-redirect
patch: |-
- op: add
path: /spec/hostnames
value: ["balancerproject.org"]
1 change: 1 addition & 0 deletions deploy/manifests/balancer/overlays/sandbox/balancer.env
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
CORS_ALLOWED_ORIGINS=https://sandbox.balancerproject.org
10 changes: 10 additions & 0 deletions deploy/manifests/balancer/overlays/sandbox/cnpg/database.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
apiVersion: postgresql.cnpg.io/v1
kind: Database
metadata:
name: balancer
namespace: cloudnative-pg
spec:
name: balancer
owner: balancer
cluster:
name: shared-cluster
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization

resources:
- database.yaml
10 changes: 10 additions & 0 deletions deploy/manifests/balancer/overlays/sandbox/configmap.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: balancer-db-config
data:
SQL_HOST: shared-cluster-rw.cloudnative-pg.svc.cluster.local
SQL_PORT: "5432"
SQL_DATABASE: balancer
SQL_USER: balancer
SQL_ENGINE: django.db.backends.postgresql
61 changes: 61 additions & 0 deletions deploy/manifests/balancer/overlays/sandbox/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization

namespace: balancer

resources:
- ../../base
- configmap.yaml

images:
- name: ghcr.io/codeforphilly/balancer-main/app
newTag: latest

configMapGenerator:
- name: balancer-config
behavior: merge
envs:
- balancer.env

patches:
- target:
kind: ListenerSet
name: balancer-listeners
patch: |-
- op: replace
path: /spec/listeners/0/hostname
value: sandbox.balancerproject.org
- op: replace
path: /spec/listeners/1/hostname
value: sandbox.balancerproject.org
- target:
kind: HTTPRoute
name: balancer
patch: |-
- op: add
path: /spec/hostnames
value: ["sandbox.balancerproject.org"]
- target:
kind: HTTPRoute
name: balancer-redirect
patch: |-
- op: add
path: /spec/hostnames
value: ["sandbox.balancerproject.org"]
- target:
kind: Deployment
name: balancer
patch: |-
- op: add
path: /spec/template/spec/containers/0/envFrom/-
value:
configMapRef:
name: balancer-db-config
- op: add
path: /spec/template/spec/containers/0/env
value:
- name: SQL_PASSWORD
valueFrom:
secretKeyRef:
name: balancer-db-credentials
key: password
5 changes: 4 additions & 1 deletion server/balancer_backend/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,10 @@

ROOT_URLCONF = "balancer_backend.urls"

CORS_ALLOW_ALL_ORIGINS = True
# CORS configuration
CORS_ALLOWED_ORIGINS = os.environ.get("CORS_ALLOWED_ORIGINS", "http://localhost:3000").split(",")
# Ensure no empty strings if input was empty or trailing comma
CORS_ALLOWED_ORIGINS = [origin.strip() for origin in CORS_ALLOWED_ORIGINS if origin.strip()]

TEMPLATES = [
{
Expand Down
Loading