apiVersion: helm.toolkit.fluxcd.io/v2beta1
kind: HelmRelease
metadata:
  name: factorio
  namespace: game-servers
spec:
  interval: 5m
  chart:
    spec:
      chart: app-template
      version: 1.3.x
      sourceRef:
        kind: HelmRepository
        name: bjws-charts
        namespace: flux-system

  values:
    image:
      repository: goofball222/factorio
      tag: "1.1.101"

    service:
      main:
        type: NodePort

#        annotations:
#          metallb.universe.tf/allow-shared-ip: "main-ip-192.168.87.10"
#          metallb.universe.tf/loadBalancerIPs: 192.168.87.10

        ports:
          http:
            enabled: false

          game:
            enabled: true
            primary: true
            port: &game_port 34197
            nodePort: 30002
            protocol: UDP

          rcon:
            enabled: true
            primary: true
            port: &rcon_port 27015
            nodePort: 30003
            protocol: TCP

    env:
      TZ: America/New_York
      FACTORIO_PORT: *game_port

    probes:
      liveness:
        enabled: false

    ingress:
      main:
        enabled: true
        annotations:
          traefik.ingress.kubernetes.io/router.entrypoints: factorio
        hosts:
          - host: "fact.${SECRET_NEW_DOMAIN}"
            paths:
              - path: /
                pathType: Prefix
                service:
                  port: *game_port
            
    persistence:
      data:
        enabled: true
        type: hostPath
        hostPath: /mnt/MainPool/Kubernetes/game-servers/factorio
        mountPath: /factorio