apiVersion: helm.toolkit.fluxcd.io/v2
kind: HelmRelease
metadata:
  name: palworld
  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: ghcr.io/jammsen/docker-palworld-dedicated-server
      tag: 1ea15dc

    env:
      TZ: America/New_York
      COMMUNITY_SERVER: false

      # Game settings
      IS_MULTIPLAY: true
      DIFFICULTY: Difficult
      NIGHTTIME_SPEEDRATE: 0.8 # shorter nights
      SERVER_NAME: ThePalFuckers
      SERVER_DESCRIPTION: A private Palworld dedi server running on a dedi server
      COOP_PLAYER_MAX_NUM: 6 # 4 is default
      RCON_ENABLED: true
      RCON_PORT: 25575
      ENABLE_NON_LOGIN_PENALTY: false

    envFrom:
      - secretRef:
          name: palworld-server-secret

    service:
      main:
        type: NodePort

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

        ports:
          http:
            enabled: false

          game:
            enabled: true
            primary: true
            port: &game_port 8211
            nodePort: 32576
            protocol: UDP

          rcon:
            enabled: true
            primary: true
            port: 25575
            nodePort: 32575
            protocol: TCP

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