apiVersion: v1
kind: Service
metadata:
  name: gitea
  namespace: gitea
  labels:
    app: gitea
spec:
  type: NodePort
  ports:
    - port: 3000
      nodePort: 30780
      targetPort: gitea
  selector:
    app: gitea
    tier: frontend
---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: gitea
  namespace: gitea
  labels:
    app: gitea
spec:
  replicas: 1
  selector:
    matchLabels:
      app: gitea
  template:
    metadata:
      labels:
        app: gitea
    spec:
      containers:
      - name: gitea
        image: gitea/gitea:latest
        ports:
        - containerPort: 3000
          name: gitea
        - containerPort: 22
          name: git-ssh
        volumeMounts:
        - mountPath: /data
          name: git-volume
      volumes:
      - name: git-volume
        persistentVolumeClaim:
          claimName: gitea-pv-claim

---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: gitea-pv-claim
  namespace: gitea
spec:
  accessModes:
    - ReadWriteOnce
  resources:
    requests:
      storage: 2Gi
