---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: factorio
  labels:
    category: game
    app: factorio
  namespace: games
spec:
  replicas: 1
  strategy:
    type: Recreate
  selector:
    matchLabels:
      app: factorio
  template:
    metadata:
      labels:
        app: factorio
    spec: 
      containers:
        - name: factorio
          image: factoriotools/factorio:1.1.60
          ports:
            - containerPort: 34197
          volumeMounts:
            - mountPath: /factorio
              name: factorio-vol
          env:
            - name: SAVE_NAME
              value: live
            - name: LOAD_LATEST_SAVE
              value: "false"
      volumes:
        - name: factorio-vol
          persistentVolumeClaim:
            claimName: factorio-pvc
      affinity:
        nodeAffinity:
          requiredDuringSchedulingIgnoredDuringExecution:
            nodeSelectorTerms:
            - matchExpressions:
              - key: kubernetes.io/arch
                operator: In
                values:
                - amd64
          preferredDuringSchedulingIgnoredDuringExecution:
          - weight: 1
            preference:
              matchExpressions:
                - key: kubernetes.io/hostname
                  operator: In
                  values:
                  - k8s-1
                  - k8s-2
