mirror of
https://github.com/jcreek/CosmicClash.git
synced 2026-09-11 08:23:45 +00:00
fix(multiplayer): bound workload credential lifetime
This commit is contained in:
@@ -30,6 +30,7 @@ func main() {
|
||||
transport := flag.String("transport", envOrDefault("COSMIC_CLASH_TRANSPORT", "enet"), "game transport: enet or steam_sdr")
|
||||
interval := flag.Duration("interval", time.Second, "allocation poll interval")
|
||||
workloadSecret := flag.String("workload-secret", os.Getenv("COSMIC_CLASH_WORKLOAD_SECRET"), "HMAC secret for control-plane-issued workload tokens (see workload/signed_token.go); must match cmd/control-plane's own --workload-secret. Unset skips minting a cosmic-clash.io/workload-token annotation entirely")
|
||||
workloadTokenTTL := flag.Duration("workload-token-ttl", agones.DefaultWorkloadTokenTTL, "lifetime for allocated workload tokens; must cover bounded match play and result retry")
|
||||
allocationQuota := flag.Int("allocation-quota", 0, "optional per-replica allocation attempts per region per quota window; zero disables this local guard")
|
||||
allocationQuotaWindow := flag.Duration("allocation-quota-window", time.Minute, "window for --allocation-quota")
|
||||
metricsAddr := flag.String("metrics-addr", envOrDefault("COSMIC_CLASH_ALLOCATOR_METRICS_ADDR", ":9091"), "allocator Prometheus metrics address; empty disables metrics")
|
||||
@@ -43,8 +44,8 @@ func main() {
|
||||
if *readinessMaxStale < *interval+*providerTimeout {
|
||||
fatalf("--readiness-max-stale must be at least --interval plus --provider-timeout")
|
||||
}
|
||||
if *allocationQuota < 0 || *allocationQuotaWindow <= 0 {
|
||||
fatalf("--allocation-quota must be non-negative and --allocation-quota-window must be positive")
|
||||
if *allocationQuota < 0 || *allocationQuotaWindow <= 0 || *workloadTokenTTL <= 0 {
|
||||
fatalf("--allocation-quota must be non-negative and --allocation-quota-window/--workload-token-ttl must be positive")
|
||||
}
|
||||
db, err := sql.Open("pgx", *dsn)
|
||||
if err != nil {
|
||||
@@ -77,7 +78,7 @@ func main() {
|
||||
if err != nil {
|
||||
fatalf("configure Kubernetes API client: %v", err)
|
||||
}
|
||||
client := agones.Client{BaseURL: *agonesURL, Namespace: *namespace, HTTP: providerHTTP, WorkloadSecret: []byte(*workloadSecret)}
|
||||
client := agones.Client{BaseURL: *agonesURL, Namespace: *namespace, HTTP: providerHTTP, WorkloadSecret: []byte(*workloadSecret), WorkloadTokenTTL: *workloadTokenTTL}
|
||||
worker := allocator.Worker{
|
||||
Claims: store.AllocatingMatchClaims{DB: db, Transport: *transport},
|
||||
Service: allocator.Service{
|
||||
|
||||
Reference in New Issue
Block a user