apiVersion: apps/v1
kind: Deployment
metadata:
  name: urbanterror
spec:
  selector:
    matchLabels:
      run: urbanterror
  replicas: 1
  template:
    metadata:
      labels:
        run: urbanterror
      annotations:
        prometheus.io/scrape: 'true'
        prometheus.io/port: '8080'
    spec:
      containers:
      - command:
        - q3
        - server
        - --config=/config/config.yaml
        - --content-server=http://127.0.0.1:9090
        - --agree-eula
        image: gitea.bp99.eu/bp99/urban-terror-server:latest
        name: server
        ports:
        - containerPort: 8080
        readinessProbe:
          tcpSocket:
            port: 8080
          initialDelaySeconds: 15
          periodSeconds: 5
        volumeMounts:
        - name: server-config
          mountPath: /config
        - name: content
          mountPath: /assets
      - command:
        - q3
        - content
        - --seed-content-url=http://content.quakejs.com
        image: gitea.bp99.eu/bp99/urban-terror-server:latest
        name: content-server
        ports:
        - containerPort: 9090
        volumeMounts:
        - name: content
          mountPath: /assets
      volumes:
        - name: server-config
          configMap:
            name: server-config
        - name: content
          emptyDir: {}
---
apiVersion: v1
kind: Service
metadata:
  name: urbanterror
spec:
  type: NodePort
  selector:
    run: urbanterror
  ports:
    - port: 8080
      targetPort: 8080
      nodePort: 30001
      name: client
    - port: 27960
      targetPort: 27960
      nodePort: 30003
      name: server
    - port: 9090
      targetPort: 9090
      nodePort: 30002
      name: content
---
apiVersion: v1
kind: ConfigMap
metadata:
  name: server-config
data:
  config.yaml: |
    fragLimit: 25
    timeLimit: 15m
    bot:
      minPlayers: 3
    game:
      motd: "Welcome to my Urban Terror server"
      type: FreeForAll
      forceRespawn: false
      inactivity: 10m
    server:
      hostname: "quakekube"
      maxClients: 12
      # password: "changeme"
    commands:
      - addbot sarge 2
    maps:
    - name: ut4_uptown
      type: FreeForAll
      timeLimit: 10m
    - name: ut4_swim
      type: FreeForAll
