diff --git a/MatrixSynapse/deployment.yaml b/MatrixSynapse/deployment.yaml new file mode 100644 index 0000000..3448bb9 --- /dev/null +++ b/MatrixSynapse/deployment.yaml @@ -0,0 +1,58 @@ + +apiVersion: apps/v1 +kind: Deployment +metadata: + name: matrix-server-deployment + labels: + matrix-service: server + + +spec: + replicas: 1 + selector: + matchLabels: + matrix-service: server + template: + metadata: + labels: + matrix-service: server + spec: + containers: + - name: matrix-server + image: matrixdotorg/synapse:latest + # imagePullPolicy: IfNotPresent + ports: + - containerPort: 8008 + name: http-matrix + protocol: TCP + + readinessProbe: + failureThreshold: 3 + httpGet: + path: /_matrix/static + port: 8008 + scheme: HTTP + initialDelaySeconds: 5 + periodSeconds: 10 + successThreshold: 1 + timeoutSeconds: 2 + livenessProbe: + failureThreshold: 3 + initialDelaySeconds: 45 + periodSeconds: 5 + successThreshold: 1 + httpGet: + path: /_matrix/static + port: 8008 + scheme: HTTP + timeoutSeconds: 1 + + volumeMounts: + - name: matrix-synapse-data + mountPath: /data + + volumes: + - name: matrix-synapse-data + persistentVolumeClaim: + claimName: matrix-synapse-data-pvc + readOnly: false diff --git a/MatrixSynapse/netPolicy.yaml b/MatrixSynapse/netPolicy.yaml new file mode 100644 index 0000000..d16dc95 --- /dev/null +++ b/MatrixSynapse/netPolicy.yaml @@ -0,0 +1,60 @@ +apiVersion: networking.k8s.io/v1 +kind: NetworkPolicy +metadata: + name: matrix-server-networkpolicy +spec: + podSelector: + matchLabels: + matrix-service: server + + egress: + # Allow all egress + # - {} + + - to: + - ipBlock: + # Address of a PSQL server + cidr: 1.2.3.4/32 + ports: + - protocol: TCP + port: 5432 + + - to: + - namespaceSelector: + matchLabels: + kubernetes.io/metadata.name: kube-system + podSelector: + matchLabels: + k8s-app: kube-dns + ports: + - protocol: UDP + port: 53 + - protocol: TCP + port: 53 + + - to: + - ipBlock: + cidr: 0.0.0.0/0 + except: + - 10.0.0.0/8 + - 172.16.0.0/12 + - 192.168.0.0/16 + + ingress: + + # optional reverse proxy + # - from: + # - namespaceSelector: + # matchLabels: + # ns-name: + # podSelector: + # matchLabels: + # podDomain: + # ports: + # - protocol: TCP + # port: 8008 + + policyTypes: + - Ingress + - Egress + diff --git a/MatrixSynapse/pvc.yaml b/MatrixSynapse/pvc.yaml new file mode 100644 index 0000000..460dcf0 --- /dev/null +++ b/MatrixSynapse/pvc.yaml @@ -0,0 +1,15 @@ +apiVersion: v1 +kind: PersistentVolumeClaim +metadata: + name: matrix-synapse-data-pvc + labels: + matrix-server-domain: example.me +spec: + # https://kubernetes.io/docs/concepts/storage/persistent-volumes/#access-modes-1 + accessModes: + # - ReadOnlyMany + - ReadWriteOnce + # - ReadWriteMany + resources: + requests: + storage: 16Gi diff --git a/MatrixSynapse/service.yaml b/MatrixSynapse/service.yaml new file mode 100644 index 0000000..2018ae0 --- /dev/null +++ b/MatrixSynapse/service.yaml @@ -0,0 +1,18 @@ +apiVersion: v1 +kind: Service +metadata: + name: matrix-server-service + labels: + matrix-service: server + +spec: + selector: + matrix-service: server + # This isn't used as Ingress is doing TLS termination + # type: LoadBalancer + type: ClusterIP + ports: + - name: matrix-server-http + appProtocol: TCP + port: 8008 # <- port that will be exposed +