---
kind: Deployment
apiVersion: apps/v1
metadata:
  name: beets
  labels:
    app: beets
spec:
  replicas: 1
  selector:
    matchLabels:
      app: beets
  template:
    metadata:
      labels:
        app: beets
    spec:
      containers:
      - name: beets
        image: lscr.io/linuxserver/beets:latest
        env:
        - name: PUID
          value: "1000"
        - name: PGID
          value: "1000"
        ports:
        - name: web
          containerPort: 80
        volumeMounts:
        - name: beets-data-volume
          mountPath: "/config"
        - name: media-volume
          mountPath: "/downloads/transmission"
          subPath: "downloads/transmission"
        - name: tesseract-nfs
          mountPath: "/music"
        #- name: media-volume
        #  mountPath: "/movies"
        #  subPath: "library/movies"
      volumes:
      - name: beets-data-volume
        persistentVolumeClaim:
          claimName: beets-data-pvc
      - name: media-volume
        persistentVolumeClaim:
          claimName: media-pvc
      - name: tesseract-nfs
        nfs:
          server: 192.168.1.87
          path: /tank/music
---
apiVersion: v1
kind: Service
metadata:
  name: beets
spec:
  type: ClusterIP
  ports:
    - name: web
      port: 8337
  selector:
    app: beets
---
apiVersion: traefik.containo.us/v1alpha1
kind: IngressRoute
metadata:
  name: beets-ingress-route
  namespace: default
spec:
  entryPoints:
    - web
  routes:
  - match: Host(`beets.dezendorf.net`)
    kind: Rule
    middlewares:
    - name: redirecthttps
    services:
    - name: beets
      port: 8337
---
apiVersion: traefik.containo.us/v1alpha1
kind: IngressRoute
metadata:
  name: beets-websecure-route
  namespace: default
spec:
  entryPoints:
    - websecure
  routes:
  - match: Host(`beets.dezendorf.net`)
    kind: Rule
    services:
    - name: beets
      port: 8337
  tls:
    certResolver: myresolver
