apiVersion: apps/v1
kind: StatefulSet
metadata:
  name: bungee-tm
  namespace: tm
spec:
  serviceName: bungee
  replicas: 1
  selector:
    matchLabels:
      role: bungee
  podManagementPolicy: Parallel
  updateStrategy:
    type: RollingUpdate
  template:
    metadata:
      labels:
        role: bungee
        type: minecraft
    spec:
      nodeSelector:
        tm: 'true'
      affinity:
        podAntiAffinity:
          preferredDuringSchedulingIgnoredDuringExecution:
            - weight: 100
              podAffinityTerm:
                topologyKey: kubernetes.io/hostname
                labelSelector:
                  matchLabels:
                    role: bungee
      containers:
        - name: bungee
          image: gcr.io/stratus-197318/minecraft:bungee-master
          imagePullPolicy: Always
          stdin: true
          tty: true
          ports:
            - containerPort: 25565
              name: minecraft
          resources:
            requests:
              cpu: 2000m
              memory: 4Gi
            limits:
              cpu: 2000m
              memory: 4Gi
          envFrom:
            - secretRef:
                name: minecraft-secret
          env:
            - name: REPLICA
              value: enabled
