apiVersion: apps/v1
kind: StatefulSet
metadata:
  name: sloop
spec:
  serviceName: sloop
  replicas: 1

  selector:
    matchLabels:
      app: sloop
  
  template:
    metadata:
      labels:
        app: sloop
    
    spec:
      serviceAccountName: sloop

      containers:
        - name: sloop
          image: sloopimage/sloop:latest@sha256:6519b3d25236dee99c977eff2bc3a53de7461c85a61707587e0dd79836b32c9a
          imagePullPolicy: IfNotPresent
          args:
            - --config=/sloopconfig/sloop.yaml
          command:
            - /sloop
          ports:
            - name: sloop
              containerPort: 8080
          resources:
            requests:
              cpu: 1
              memory: 1Gi
            limits:
              cpu: 2
              memory: 2Gi
          livenessProbe:
            httpGet:
              path: /healthz
              port: 8080
            initialDelaySeconds: 30
            periodSeconds: 10
            timeoutSeconds: 5
            successThreshold: 1
            failureThreshold: 3
          readinessProbe:
            httpGet:
              path: /healthz
              port: 8080
            initialDelaySeconds: 5
            periodSeconds: 10
            timeoutSeconds: 5
            successThreshold: 1
            failureThreshold: 3
          volumeMounts:
            - mountPath: /data/
              name: data
            - mountPath: /sloopconfig/
              name: config

      volumes:
        - name: data
          emptyDir:
            sizeLimit: 1Gi
          
        - name: config
          configMap:
            name: sloop

  volumeClaimTemplates:
    - metadata:
        name: data
      spec:
        accessModes:
          - ReadWriteOnce
        resources:
          requests:
            storage: 1Gi
