---
apiVersion: v1
kind: Namespace
metadata:
  name: uptime-kuma
  labels:
    app: uptime-kuma
    app.kubernetes.io/instance: uptime-kuma
    app.kubernetes.io/name: uptime-kuma

---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: uptime-kuma
  namespace: uptime-kuma
  labels:
    app: uptime-kuma
    app.kubernetes.io/instance: uptime-kuma
    app.kubernetes.io/name: uptime-kuma
spec:
  replicas: 1
  selector:
    matchLabels:
      app: uptime-kuma
  template:
    metadata:
      labels:
        app: uptime-kuma
        app.kubernetes.io/instance: uptime-kuma
        app.kubernetes.io/name: uptime-kuma
    spec:
      nodeSelector:
        worker: "true"
      containers:
        - name: uptime-kuma
          image: louislam/uptime-kuma:1
          ports:
            - containerPort: 3001
          volumeMounts:
            - name: uptime-kuma
              mountPath: /app/data
      volumes:
        - name: uptime-kuma
          persistentVolumeClaim:
            claimName: uptime-kuma

---
apiVersion: v1
kind: Service
metadata:
  name: uptime-kuma
  namespace: uptime-kuma
  labels:
    app: uptime-kuma
    app.kubernetes.io/instance: uptime-kuma
    app.kubernetes.io/name: uptime-kuma
spec:
  type: ClusterIP
  selector:
    app: uptime-kuma
  ports:
    - name: http
      port: 80
      targetPort: 3001

---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: uptime-kuma-data
  namespace: uptime-kuma
  labels:
    app: uptime-kuma
    app.kubernetes.io/instance: uptime-kuma
    app.kubernetes.io/name: uptime-kuma
spec:
  accessModes:
    - ReadWriteOnce
  resources:
    requests:
      storage: 3Gi
  storageClassName: longhorn