# services/nextcloud/collabora.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
  name: collabora
  namespace: nextcloud
  labels:
    app: collabora
spec:
  replicas: 1
  selector:
    matchLabels:
      app: collabora
  template:
    metadata:
      annotations:
        descheduler.alpha.kubernetes.io/evict: "false"
      labels:
        app: collabora
    spec:
      nodeSelector:
        kubernetes.io/arch: amd64
      containers:
        - name: collabora
          image: collabora/code@sha256:3c58d0e9bae75e4647467d0c7d91cb66f261d3e814709aed590b5c334a04db26
          imagePullPolicy: IfNotPresent
          env:
            - name: domain
              value: cloud\\.bstein\\.dev
            - name: DONT_GEN_SSL_CERT
              value: "true"
            - name: extra_params
              value: --o:ssl.enable=false --o:ssl.termination=true
          ports:
            - containerPort: 9980
              name: http
          resources:
            requests:
              cpu: 250m
              memory: 512Mi
            limits:
              cpu: 1
              memory: 2Gi
---
apiVersion: v1
kind: Service
metadata:
  name: collabora
  namespace: nextcloud
spec:
  selector:
    app: collabora
  ports:
    - name: http
      port: 9980
      targetPort: http
---
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: collabora
  namespace: nextcloud
  annotations:
    cert-manager.io/cluster-issuer: letsencrypt-prod
    traefik.ingress.kubernetes.io/router.entrypoints: websecure
    traefik.ingress.kubernetes.io/router.tls: "true"
spec:
  tls:
    - hosts:
        - office.bstein.dev
      secretName: collabora-tls
  rules:
    - host: office.bstein.dev
      http:
        paths:
          - path: /
            pathType: Prefix
            backend:
              service:
                name: collabora
                port:
                  number: 9980
