apiVersion: v1
kind: Secret
metadata:
  name: matrix-sliding-sync
  namespace: chat
  annotations:
    kube-1password: 7kvyfcszfaavj2d7uvl4troagm
    kube-1password/vault: Kubernetes
    kube-1password/secret-text-parse: "true"
  labels:
    app.kubernetes.io/name: "matrix"
    component: sliding-sync
type: Opaque
---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: sliding-sync
  namespace: chat
  labels:
    app.kubernetes.io/name: "matrix"
    component: sliding-sync
spec:
  replicas: 1
  selector:
    matchLabels:
      app.kubernetes.io/name: sliding-sync
  template:
    metadata:
      labels:
        app.kubernetes.io/name: sliding-sync
    spec:
      securityContext:
        runAsUser: 1000
        runAsGroup: 1000
        fsGroup: 1000
      containers:
        - name: "sliding-sync"
          image: "ghcr.io/matrix-org/sliding-sync:v0.99.19"
          imagePullPolicy: IfNotPresent
          ports:
            - name: http
              containerPort: 8008
              protocol: TCP
            - name: metrics
              containerPort: 9090
              protocol: TCP
          env:
          - name: SYNCV3_SERVER
            value: https://matrix.cluster.fun
          - name: SYNCV3_BINDADDR
            value: ":8008"
          - name: SYNCV3_PROM
            value: ":9090"
          - name: SYNCV3_SECRET
            valueFrom:
              secretKeyRef:
                name: matrix-sliding-sync
                key: SYNCV3_SECRET
          - name: SYNCV3_DB
            valueFrom:
              secretKeyRef:
                name: matrix-sliding-sync
                key: SYNCV3_DB
---
apiVersion: v1
kind: Service
metadata:
  name: sliding-sync
  namespace: chat
  labels:
    app.kubernetes.io/name: "matrix"
    component: sliding-sync
  annotations:
    prometheus.io/scrape: "true"
    prometheus.io/port: "9090"
spec:
  type: ClusterIP
  ports:
  - port: 80
    targetPort: http
    name: web
  - port: 9090
    targetPort: metrics
    protocol: TCP
    name: metrics
  selector:
    app.kubernetes.io/name: sliding-sync
---
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: sliding-sync
  namespace: chat
  labels:
    app.kubernetes.io/name: "matrix"
    component: sliding-sync
  annotations:
    cert-manager.io/cluster-issuer: letsencrypt
    nginx.ingress.kubernetes.io/force-ssl-redirect: "true"
    nginx.ingress.kubernetes.io/proxy-body-size: "0"
spec:
  ingressClassName: nginx
  tls:
  - hosts:
    - syncv3.matrix.cluster.fun
    secretName: sliding-sync-ingress
  rules:
  - host: syncv3.matrix.cluster.fun
    http:
      paths:
      - path: /
        pathType: ImplementationSpecific
        backend:
          service:
            name: sliding-sync
            port:
              number: 80
---