apiVersion: apps/v1
kind: StatefulSet
metadata:
  name: lobby-tm
  namespace: tm
spec:
  serviceName: lobby
  selector:
    matchLabels:
      role: lobby
  template:
    metadata:
      labels:
        role: lobby
        type: minecraft
    spec:
      nodeSelector:
        tm: 'true'
      containers:
        - name: minecraft
          image: gcr.io/stratus-197318/minecraft:bukkit-master
          imagePullPolicy: Always
          stdin: true
          tty: true
          ports:
            - containerPort: 25565
              name: minecraft
          readinessProbe:
            initialDelaySeconds: 15
            periodSeconds: 15
            timeoutSeconds: 5
            exec:
              command:
                - ruby
                - run.rb
                - ready?
          livenessProbe:
            initialDelaySeconds: 60
            periodSeconds: 30
            timeoutSeconds: 5
            exec:
              command:
                - ruby
                - run.rb
                - alive?
          resources:
            requests:
              cpu: 1000m
              memory: 4Gi
            limits:
              cpu: 2000m
              memory: 4Gi
          envFrom:
            - secretRef:
                name: minecraft-secret
          env:
            - name: REPLICA
              value: enabled
          volumeMounts:
            - name: maps
              mountPath: /minecraft/maps:ro
      volumes:
        - name: maps
          hostPath:
            path: /storage/maps-tournament
