# services/comms/element-call-deployment.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
  name: element-call
  labels:
    app: element-call
spec:
  replicas: 1
  selector:
    matchLabels:
      app: element-call
  template:
    metadata:
      labels:
        app: element-call
    spec:
      nodeSelector:
        hardware: rpi5
        node-role.kubernetes.io/worker: "true"
      containers:
        - name: element-call
          image: ghcr.io/element-hq/element-call@sha256:e6897c7818331714eae19d83ef8ea94a8b41115f0d8d3f62c2fed2d02c65c9bc
          ports:
            - containerPort: 8080
              name: http
          volumeMounts:
            - name: config
              mountPath: /app/config.json
              subPath: config.json
      volumes:
        - name: config
          configMap:
            name: element-call-config
            items:
              - key: config.json
                path: config.json
            optional: false
---
apiVersion: v1
kind: Service
metadata:
  name: element-call
spec:
  selector:
    app: element-call
  ports:
    - name: http
      port: 80
      targetPort: 8080
---
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: element-call
  annotations:
    kubernetes.io/ingress.class: traefik
    traefik.ingress.kubernetes.io/router.entrypoints: websecure
    traefik.ingress.kubernetes.io/router.tls: "true"
    cert-manager.io/cluster-issuer: letsencrypt
spec:
  tls:
    - hosts:
        - call.live.bstein.dev
      secretName: call-live-tls
  rules:
    - host: call.live.bstein.dev
      http:
        paths:
          - path: /
            pathType: Prefix
            backend:
              service:
                name: element-call
                port:
                  number: 80
