// Copyright Epic Games, Inc. All Rights Reserved. #pragma once #include #include namespace zen::nomad { /** Nomad task driver type. */ enum class Driver { RawExec, ///< Use Nomad raw_exec driver (direct process execution) Docker, ///< Use Nomad Docker driver }; /** How the zenserver binary is made available on Nomad clients. */ enum class BinaryDistribution { PreDeployed, ///< Binary is already present on Nomad client nodes Artifact, ///< Download binary via Nomad artifact stanza }; /** Configuration for Nomad worker provisioning. * * Specifies the Nomad server URL, authentication, resource limits, and * job configuration. Used by NomadClient and NomadProvisioner. */ struct NomadConfig { bool Enabled = false; ///< Whether Nomad provisioning is active std::string ServerUrl; ///< Nomad HTTP API URL (e.g. "http://localhost:4646") std::string AclToken; ///< Nomad ACL token (sent as X-Nomad-Token header) std::string Datacenter = "dc1"; ///< Target datacenter std::string Namespace = "default"; ///< Nomad namespace std::string Region; ///< Nomad region (empty = server default) Driver TaskDriver = Driver::RawExec; ///< Task driver for job execution BinaryDistribution BinDistribution = BinaryDistribution::PreDeployed; ///< How to distribute the zenserver binary std::string BinaryPath; ///< Path to zenserver on Nomad clients (PreDeployed mode) std::string ArtifactSource; ///< URL to download zenserver binary (Artifact mode) std::string DockerImage; ///< Docker image name (Docker driver mode) int MaxJobs = 64; ///< Maximum concurrent Nomad jobs int CpuMhz = 1000; ///< CPU MHz allocated per task int MemoryMb = 2048; ///< Memory MB allocated per task int CoresPerJob = 32; ///< Estimated cores per job (for scaling calculations) int MaxCores = 2048; ///< Maximum total cores to provision std::string JobPrefix = "zenserver-worker"; ///< Prefix for generated Nomad job IDs /** Validate the configuration. Returns false if required fields are missing * or incompatible options are set. */ bool Validate() const; }; const char* ToString(Driver D); const char* ToString(BinaryDistribution Dist); bool FromString(Driver& OutDriver, std::string_view Str); bool FromString(BinaryDistribution& OutDist, std::string_view Str); } // namespace zen::nomad