apiVersion: v1
kind: Namespace
metadata:
  name: stirling
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: stirling-pvc
  namespace: stirling
spec:
  accessModes:
    - ReadWriteOnce
  storageClassName: local-path
  resources:
    requests:
      storage: 2Gi
---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: stirling
  namespace: stirling
spec:
  replicas: 1
  selector:
    matchLabels:
      app: stirling
  template:
    metadata:
      labels:
        app: stirling
    spec:
      containers:
        - name: stirling
          image: frooodle/s-pdf:latest
          ports:
            - containerPort: 8080
          env:
            - name: DOCKER_ENABLE_SECURITY
              value: "false"
          volumeMounts:
            - name: stirling-data
              mountPath: /usr/share/tessdata
      volumes:
        - name: stirling-data
          persistentVolumeClaim:
            claimName: stirling-pvc
---
apiVersion: v1
kind: Service
metadata:
  name: stirling
  namespace: stirling
spec:
  selector:
    app: stirling
  ports:
    - port: 8080
      targetPort: 8080
---
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: stirling
  namespace: stirling
  annotations:
    cert-manager.io/cluster-issuer: letsencrypt
spec:
  ingressClassName: traefik
  tls:
    - hosts:
        - pdf.roysland.net
      secretName: stirling-tls
  rules:
    - host: pdf.roysland.net
      http:
        paths:
          - path: /
            pathType: Prefix
            backend:
              service:
                name: stirling
                port:
                  number: 8080
