feat(networking): Deploy pod on db-primary node for internal traffic

This commit is contained in:
Tanguy Herbron 2025-04-29 17:28:32 +02:00
parent bd8607101a
commit 1509b8fdf4
4 changed files with 40 additions and 0 deletions

View File

@ -0,0 +1,17 @@
apiVersion: v1
kind: Service
metadata:
label:
cnpg.io/cluster: synapse-db
name: synapse-db
namespace: synapse
spec:
internalTrafficPolicy: Local
ports:
- name: postgres
port: 5432
protocol: TCP
targetPort: 5432
selector:
cnpg.io/cluster: synapse-db
cnpg.io/instanceRole: primary

View File

@ -52,3 +52,11 @@ spec:
monitoring: monitoring:
enablePodMonitor: true enablePodMonitor: true
topologySpreadConstraints:
- maxSkew: 1
topologyKey: zone
whenUnsatisfiable: DoNotSchedule
labelSelector:
matchLabels:
cnpg.io/cluster: synapse-db

View File

@ -15,6 +15,20 @@ spec:
spec: spec:
securityContext: securityContext:
fsGroup: 991 fsGroup: 991
affinity:
podAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
- labelSelector:
matchExpressions:
- key: cnpg.io/cluster
operator: In
values:
- synapse-db
- key: cnpg.io/instanceRole
operator: In
values:
- primary
topologyKey: "kubernetes.io/hostname"
containers: containers:
- name: synapse - name: synapse
image: ghcr.io/element-hq/synapse:v1.128.0 image: ghcr.io/element-hq/synapse:v1.128.0

View File

@ -6,6 +6,7 @@ resources:
- pvc.yaml - pvc.yaml
- database.yaml - database.yaml
- database-backup.yaml - database-backup.yaml
- database-local-service.yaml
- service.yaml - service.yaml
- servicemonitor.yaml - servicemonitor.yaml
- ingress.yaml - ingress.yaml