apiVersion: apps/v1
kind: StatefulSet
metadata:
  name: synapse
  namespace: matrixorg
spec:
  selector:
    matchLabels:
      service: synapse
  serviceName: synapse
  template:
    metadata:
      labels:
        service: synapse
    spec:
      containers:
        - name: synapse
          image: matrixdotorg/synapse:latest
          ports:
            - containerPort: 8448
              name: federation
          volumeMounts:
            - name: synapse-data
              mountPath: /data
            - name: synapse-config
              mountPath: /config/frikanalen.no.log.config  
              subPath: frikanalen.no.log.config  
            - name: synapse-config
              mountPath: /config/homeserver.yaml
              subPath: homeserver.yaml
            - name: pgsecret-for-synapse
              mountPath: /config/database.yaml
              subPath: database.yaml
            - name: synapse-secrets
              mountPath: /secrets
          env:
            - name: SYNAPSE_CONFIG_PATH
              value: /config
      volumes:
        - name: synapse-secrets
          secret:
            secretName: synapse-secrets
        - name: pgsecret-for-synapse
          secret:
            secretName: pgsecret-for-synapse
        - name: synapse-config
          configMap:
            name: synapse-config
        - name: synapse-data
          persistentVolumeClaim:
            claimName: synapse-data
