refactor: update worker processes in EvoBGP to accept dependencies for shared store and job registry. Enhance scheduler, ingest, render, and deploy components to utilize a unified context and improve logging for drift detection. Update architecture documentation to reflect changes in process interactions and worker functionalities.
CI / changes (push) Successful in 5s
CI / go (push) Failing after 9s
CI / openapi (push) Has been skipped
CI / bird2 (push) Has been skipped

This commit is contained in:
Denozordec
2026-04-05 17:42:07 +07:00
parent 5d21f013cf
commit b7968db4e0
22 changed files with 936 additions and 77 deletions
+34 -1
View File
@@ -3,11 +3,15 @@ package main
import (
"context"
"log"
"net/http"
"os"
"os/signal"
"strings"
"syscall"
"time"
"evobgp/internal/config"
"evobgp/internal/httpapi"
"evobgp/internal/scheduler"
)
@@ -20,5 +24,34 @@ func main() {
log.Printf("%s starting (reference profile worker)", name)
ctx, stop := signal.NotifyContext(context.Background(), os.Interrupt, syscall.SIGTERM)
defer stop()
scheduler.Run(ctx)
bctx, bcancel := context.WithTimeout(context.Background(), 90*time.Second)
defer bcancel()
opts := httpapi.Options{
DatabaseURL: strings.TrimSpace(os.Getenv("EVOBGP_DATABASE_URL")),
SeedDemo: os.Getenv("EVOBGP_SEED_DEMO") != "0",
}
st, reg, pool, err := httpapi.BootstrapWorkers(bctx, opts)
if err != nil {
log.Fatal(err)
}
if pool != nil {
defer pool.Close()
}
apiBase := strings.TrimSpace(os.Getenv("EVOBGP_CONTROL_PLANE_URL"))
apiTok := strings.TrimSpace(os.Getenv("EVOBGP_SCHEDULER_BEARER"))
deps := &scheduler.Deps{
Store: st,
HTTP: &http.Client{Timeout: 45 * time.Second},
}
if apiBase != "" && apiTok != "" {
deps.APIBase = apiBase
deps.APIToken = apiTok
log.Printf("evobgp-scheduler: control plane HTTP mode (%s)", apiBase)
} else {
deps.Jobs = reg
log.Printf("evobgp-scheduler: in-process job registry mode (use EVOBGP_CONTROL_PLANE_URL + EVOBGP_SCHEDULER_BEARER for split containers)")
}
scheduler.Run(ctx, deps)
}