commit 3cf73589e1edf1c44edac422abfe17609fd417a5 Author: Tanguy Herbron Date: Sat Jul 29 16:13:54 2023 +0200 feat(*): Initial commit diff --git a/README.md b/README.md new file mode 100644 index 0000000..e69de29 diff --git a/manifests/configmap.yaml b/manifests/configmap.yaml new file mode 100644 index 0000000..99ba7ea --- /dev/null +++ b/manifests/configmap.yaml @@ -0,0 +1,22 @@ +apiVersion: v1 +kind: ConfigMap +metadata: + name: synapse-config + namespace: synapse +data: + matrix.beta.halia.dev.log.config: | + version: 1 + formatters: + precise: + format: '%(asctime)s - %(name)s - %(lineno)d - %(levelname)s - %(request)s - %(message)s' + handlers: + console: + class: logging.StreamHandler + formatter: precise + loggers: + synapse.storage.SQL: + level: INFO + root: + level: INFO + handlersr: [console] + disable_existing_loggers: false diff --git a/manifests/database.yaml b/manifests/database.yaml new file mode 100644 index 0000000..f741207 --- /dev/null +++ b/manifests/database.yaml @@ -0,0 +1,31 @@ +apiVersion: postgresql.cnpg.io/v1 +kind: Cluster +metadata: + name: synapse-db + namespace: synapse + +spec: + instances: 1 + + storage: + size: 5Gi + storageClass: flat-storage-class + + bootstrap: + initdb: + database: synapse + owner: synapse + secret: + name: synapse-db + + postgresql: + pg_hba: + - host all all all md5 + + resources: + requests: + cpu: 100m + memory: 100Mi + limits: + cpu: 500m + memory: 500Mi diff --git a/manifests/deployment.yaml b/manifests/deployment.yaml new file mode 100644 index 0000000..78f4cf1 --- /dev/null +++ b/manifests/deployment.yaml @@ -0,0 +1,42 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: synapse + namespace: synapse +spec: + replicas: 1 + selector: + matchLabels: + app: synapse + template: + metadata: + labels: + app: synapse + spec: + securityContext: + fsGroup: 991 + containers: + - name: synapse + image: matrixdotorg/synapse:latest + ports: + - containerPort: 8008 + - containerPort: 9009 + volumeMounts: + - mountPath: "/data" + name: synapse-data + - mountPath: "/data/homeserver.yaml" + name: synapse-config-file + subPath: homeserver.yaml + - mountPath: "/data/matrix.beta.halia.dev.log.config" + name: synapse-log-config-file + subPath: matrix.beta.halia.dev.log.config + volumes: + - name: synapse-data + persistentVolumeClaim: + claimName: synapse-pvc + - name: synapse-config-file + secret: + secretName: synapse-secret-config + - name: synapse-log-config-file + configMap: + name: synapse-config diff --git a/manifests/ingress.yaml b/manifests/ingress.yaml new file mode 100644 index 0000000..d5baf94 --- /dev/null +++ b/manifests/ingress.yaml @@ -0,0 +1,23 @@ +apiVersion: networking.k8s.io/v1 +kind: Ingress +metadata: + name: synapse-ingress + namespace: synapse + annotations: + kubernetes.io/ingress.class: "traefik" +spec: + tls: + - secretName: synapse-beta-tls + hosts: + - matrix.beta.halia.dev + rules: + - host: matrix.beta.halia.dev + http: + paths: + - path: / + pathType: Prefix + backend: + service: + name: synapse-svc + port: + number: 80 diff --git a/manifests/kustomization.yaml b/manifests/kustomization.yaml new file mode 100644 index 0000000..1a47acf --- /dev/null +++ b/manifests/kustomization.yaml @@ -0,0 +1,13 @@ +apiVersion: kustomize.config.k8s.io/v1beta1 +kind: Kustomization + +resources: + - namespace.yaml + - pvc.yaml + - database.yaml + - service.yaml + - servicemonitor.yaml + - ingress.yaml + - configmap.yaml + - deployment.yaml + diff --git a/manifests/namespace.yaml b/manifests/namespace.yaml new file mode 100644 index 0000000..4ffb611 --- /dev/null +++ b/manifests/namespace.yaml @@ -0,0 +1,4 @@ +apiVersion: v1 +kind: Namespace +metadata: + name: synapse diff --git a/manifests/pvc.yaml b/manifests/pvc.yaml new file mode 100644 index 0000000..0a50fa7 --- /dev/null +++ b/manifests/pvc.yaml @@ -0,0 +1,12 @@ +apiVersion: v1 +kind: PersistentVolumeClaim +metadata: + name: synapse-pvc + namespace: synapse +spec: + accessModes: + - ReadWriteOnce + storageClassName: flat-storage-class + resources: + requests: + storage: 1Gi diff --git a/manifests/service.yaml b/manifests/service.yaml new file mode 100644 index 0000000..537d096 --- /dev/null +++ b/manifests/service.yaml @@ -0,0 +1,19 @@ +apiVersion: v1 +kind: Service +metadata: + name: synapse-svc + namespace: synapse + labels: + app.kubernetes.io/name: synapse +spec: + ports: + - name: http + port: 80 + protocol: TCP + targetPort: 8008 + - name: metrics + port: 9000 + protocol: TCP + targetPort: 9009 + selector: + app: synapse diff --git a/manifests/servicemonitor.yaml b/manifests/servicemonitor.yaml new file mode 100644 index 0000000..a40e5e8 --- /dev/null +++ b/manifests/servicemonitor.yaml @@ -0,0 +1,14 @@ +apiVersion: monitoring.coreos.com/v1 +kind: ServiceMonitor +metadata: + name: synapse + namespace: synapse + labels: + team: core +spec: + selector: + matchLabels: + app.kubernetes.io/name: synapse + endpoints: + - port: metrics + path: /