apiVersion: apps/v1
kind: StatefulSet
metadata:
  name: mc-events
  namespace: games
  labels:
    app: mc-events
    backup: "true"
spec:
  replicas: 1
  selector:
    matchLabels:
      app: mc-events
  serviceName: mc-events
  template:
    metadata:
      labels:
        app: mc-events
        backup: "true"
    spec:
      containers:
      - name: mc-events
        image: harbor.fnptr.net/gameservers/papermc:latest
        imagePullPolicy: Always
        resources:
          limits:
            cpu: "4"
            memory: "6Gi"
          requests:
            cpu: "4"
            memory: "6Gi"
        ports:
        - containerPort: 25565
        env:
        - name: EULA
          value: "true"
        - name: MC_OPTS
          value: "-server -XX:+UseG1GC -XX:MaxGCPauseMillis=500 -XX:+UseStringDeduplication -Xmx4G -Xms4G -XX:UseSSE=3"
        volumeMounts:
          - mountPath: /data/
            name: mc-events-data
          - mountPath: /config
            name: mc-events-config-volume
      - name: openssh
        image: harbor.fnptr.net/docker/linuxserver/openssh-server:latest
        ports:
        - containerPort: 2222
        env:
        - name: USER_NAME
          value: "ssh"
        - name: PUID
          value: "1000"
        - name: PGID
          value: "1000"
        - name: PUBLIC_KEY
          value: "ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBF7fNKAdx8LjUlUAQAloghaLi/YB9fRK5uCA1HBQ7hQMBfG2IxfeeCIgftxyvJDzCoKFfEdWu6lBPFauztuDzPE="
        volumeMounts:
          - mountPath: /data
            name: mc-events-data
      volumes:
      - name: mc-events-config-volume
        configMap:
          name: mc-events-config
      securityContext:
        fsGroup: 1000
  volumeClaimTemplates:
  - metadata:
      name: mc-events-data
      namespace: games
      labels:
        app: mc-events
        backup: "true"
    spec:
      storageClassName: openebs-sc-ssd
      accessModes:
      - ReadWriteOnce
      resources:
        requests:
          storage: 16Gi