feat(networking): Schedule pod on primary db's node
This commit is contained in:
parent
c688bea958
commit
62b3591144
17
manifests/database-local-service.yaml
Normal file
17
manifests/database-local-service.yaml
Normal file
@ -0,0 +1,17 @@
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
labels:
|
||||
app: mastodon-db
|
||||
name: mastodon-db-local
|
||||
namespace: mastodon
|
||||
spec:
|
||||
internalTrafficPolicy: Local
|
||||
ports:
|
||||
- name: postgres
|
||||
port: 5432
|
||||
protocol: TCP
|
||||
targetPort: 5432
|
||||
selector:
|
||||
cnpg.io/cluster: mastodon-db
|
||||
cnpg.io/instanceRole: primary
|
@ -8,7 +8,7 @@ spec:
|
||||
instances: 3
|
||||
|
||||
storage:
|
||||
size: 1Gi
|
||||
size: 2Gi
|
||||
storageClass: local-path
|
||||
|
||||
bootstrap:
|
||||
@ -50,3 +50,11 @@ spec:
|
||||
|
||||
monitoring:
|
||||
enablePodMonitor: true
|
||||
|
||||
topologySpreadConstraints:
|
||||
- maxSkew: 1
|
||||
topologyKey: zone
|
||||
whenUnsatisfiable: DoNotSchedule
|
||||
labelSelector:
|
||||
matchLabels:
|
||||
cnpg.io/cluster: mastodon-db
|
||||
|
@ -24,7 +24,19 @@ spec:
|
||||
operator: In
|
||||
values:
|
||||
- mastodon-db
|
||||
- key: cnpg.io/instanceRole
|
||||
operator: In
|
||||
values:
|
||||
- primary
|
||||
topologyKey: "kubernetes.io/hostname"
|
||||
nodeAffinity:
|
||||
requiredDuringSchedulingIgnoredDuringExecution:
|
||||
nodeSelectorTerms:
|
||||
- matchExpressions:
|
||||
- key: "kubernetes.io/arch"
|
||||
operator: In
|
||||
values:
|
||||
- "amd64"
|
||||
securityContext:
|
||||
runAsUser: 991
|
||||
runAsGroup: 991
|
||||
@ -47,7 +59,7 @@ spec:
|
||||
- name: REDIS_PORT
|
||||
value: "6379"
|
||||
- name: DB_HOST
|
||||
value: "mastodon-db-rw.mastodon.svc.cluster.local"
|
||||
value: "mastodon-db-local.mastodon.svc.cluster.local"
|
||||
- name: DB_USER
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
@ -117,7 +129,7 @@ spec:
|
||||
- mountPath: "/mastodon/public/system"
|
||||
name: mastodon-data
|
||||
- name: mastodon-streaming
|
||||
image: ghcr.io/mastodon/mastodon-streaming:v4.3.6
|
||||
image: ghcr.io/mastodon/mastodon-streaming:v4.3.7
|
||||
command: ["node", "./streaming/index.js"]
|
||||
ports:
|
||||
- containerPort: 4000
|
||||
@ -143,7 +155,7 @@ spec:
|
||||
- name: REDIS_PORT
|
||||
value: "6379"
|
||||
- name: mastodon-sidekiq
|
||||
image: ghcr.io/mastodon/mastodon:v4.3.6
|
||||
image: ghcr.io/mastodon/mastodon:v4.3.7
|
||||
command: ["bundle", "exec", "sidekiq"]
|
||||
ports:
|
||||
- containerPort: 9395
|
||||
|
@ -5,8 +5,9 @@ resources:
|
||||
- namespace.yaml
|
||||
- secrets.yaml
|
||||
- database.yaml
|
||||
- deployment.yaml
|
||||
- database-backup.yaml
|
||||
- database-local-service.yaml
|
||||
- deployment.yaml
|
||||
- service.yaml
|
||||
- servicemonitor.yaml
|
||||
- redis-service.yaml
|
||||
|
Loading…
x
Reference in New Issue
Block a user