feat(networking): Deploy pod on primary db instance host

This commit is contained in:
Tanguy Herbron 2025-04-29 17:44:32 +02:00
parent 8953969ca4
commit 956af48dee
4 changed files with 41 additions and 1 deletions

View File

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

View File

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

View File

@ -15,6 +15,20 @@ spec:
spec:
hostname: zitadel
subdomain: zitadel
affinity:
podAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
- labelSelector:
matchExpressions:
- key: cnpg.io/cluster
operator: In
values:
- zitadel-db
- key: cnpg.io/instanceRole
operator: In
values:
- primary
topologyKey: "kubernetes.io/hostname"
containers:
- name: zitadel
image: ghcr.io/zitadel/zitadel:v2.71.1
@ -29,7 +43,7 @@ spec:
- containerPort: 8080
env:
- name: ZITADEL_DATABASE_POSTGRES_HOST
value: "zitadel-db-rw.zitadel.svc.cluster.local"
value: "zitadel-db-local.zitadel.svc.cluster.local"
- name: ZITADEL_DATABASE_POSTGRES_PORT
value: "5432"
- name: ZITADEL_DATABASE_POSTGRES_DATABASE

View File

@ -8,5 +8,6 @@ resources:
- ingress.yaml
- database.yaml
- database-backup.yaml
- database-local-service.yaml
- configmap.yaml
- deployment.yaml