apiVersion: apps/v1
kind: StatefulSet
metadata:
  labels:
    app: gitea
  name: gitea
spec:
  serviceName: gitea
  podManagementPolicy: OrderedReady
  replicas: 1
  selector:
    matchLabels:
      app: gitea
  template:
    metadata:
      labels:
        app: gitea
    spec:
      containers:
        - name: gitea
          image: gitea/gitea:1
          imagePullPolicy: IfNotPresent
          ports:
            - name: web
              containerPort: 3000
              protocol: TCP
            - name: ssh
              containerPort: 22
              protocol: TCP
          envFrom:
            - configMapRef:
                name: gitea
                optional: false
          volumeMounts:
            - name: data
              mountPath: /data
          livenessProbe:
            initialDelaySeconds: 5
            exec:
              command:
                - /bin/bash
                - -ec
                - curl -if http://localhost:3000/version
          readinessProbe:
            initialDelaySeconds: 5
            exec:
              command:
                - /bin/bash
                - -ec
                - curl -if http://localhost:3000/version
      volumes:
        - name: data
          emptyDir: { }
