apiVersion: v1
kind: PersistentVolume
metadata:
  name: kallithea-data
  labels:
    type: local
spec:
  storageClassName: manual
  hostPath:
    path: "/opt/kallithea"
  capacity:
    storage: 50Gi
  accessModes:
    - ReadWriteOnce
  persistentVolumeReclaimPolicy: Retain
  claimRef:
    namespace: default
    name: kallithea-data
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: kallithea-data
spec:
  storageClassName: ""
  volumeName: kallithea-data
  accessModes:
    - ReadWriteOnce
  resources:
    requests:
      storage: 50Gi
---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: kallithea
spec:
  replicas: 1
  selector:
    matchLabels:
      app: kallithea
  template:
    metadata:
      labels:
        app: kallithea
      annotations:
        prometheus.io/scrape: "false"
    spec:
      volumes:
        - name: data
          persistentVolumeClaim:
            claimName: kallithea-data
      containers:
        - name: kallithea
          image: docker.io/toras9000/kallithea-mp:0.7.0
          ports:
            - containerPort: 5000
          volumeMounts:
            - { name: data, subPath: 'config', mountPath: /kallithea/config }
            - { name: data, subPath: 'repos', mountPath: /kallithea/repos }
      affinity:
        nodeAffinity:
          requiredDuringSchedulingIgnoredDuringExecution:
            nodeSelectorTerms:
              - matchExpressions:
                  - key: "kubernetes.io/hostname"
                    operator: In
                    values: ["ditto"]
---
apiVersion: v1
kind: Service
metadata:
  name: kallithea
spec:
  type: LoadBalancer
  ports:
    - port: 80
      targetPort: 5000
  selector:
    app: kallithea
