apiVersion: apps/v1
kind: StatefulSet
metadata:
  name: minecraft
  namespace: minecraft
spec:
  replicas: 1
  selector:
    matchLabels:
      app: minecraft
  template:
    metadata:
      labels:
        app: minecraft
    spec:
      hostNetwork: true   # equivalente ao network_mode: host
      securityContext:
        runAsNonRoot: true
        runAsUser: 1013
        fsGroup: 1013
      imagePullSecrets:
      - name: regcred
      containers:
      - name: playit
        image: ghcr.io/playit-cloud/playit-agent:0.17
        env:
          - name: SECRET_KEY
            valueFrom:
              secretKeyRef:
                name: minecraft-secret  # nome do Secret
                key: SECRET_KEY      # chave dentro do Secret
      - name: minecraft
        image: itzg/minecraft-server
        stdin: true
        tty: true
        resources:
          requests:
            cpu: 2
            memory: 5Gi
          limits:
            cpu: 2
            memory: 11Gi
        envFrom:
          - configMapRef:
              name: minecraft-configmap
        ports:
          - containerPort: 25565 
            name: serverport
          - containerPort: 8100 
            name: bluemap
          - containerPort: 25575 
            name: rcon
        volumeMounts:
        - name: data
          mountPath: /data
      volumes:
      - name: data
        persistentVolumeClaim:
          claimName: minecraft-config-pvc



