ControlPlaneConfig extends server.Config with control-plane-specific settings.
| 33 | ) |
| 34 | |
| 35 | // DefaultAdmissionReclaimerMaxReservations bounds cleanup ownership retained by |
| 36 | // one control-plane process when the operator does not configure a value. |
| 37 | const DefaultAdmissionReclaimerMaxReservations = defaultAdmissionReclaimerReservations |
| 38 | |
| 39 | // ControlPlaneConfig extends server.Config with control-plane-specific settings. |
| 40 | type ControlPlaneConfig struct { |
| 41 | server.Config |
| 42 | |
| 43 | Process ProcessConfig |
| 44 | |
| 45 | SocketDir string |
| 46 | ConfigPath string // Path to config file, passed to workers |
| 47 | HealthCheckInterval time.Duration |
| 48 | WorkerQueueTimeout time.Duration // How long to wait for an available worker/org connection slot (default: 60s) |
| 49 | WorkerIdleTimeout time.Duration // How long to keep an idle worker alive (default: 5m) |
| 50 | RetireOnSessionEnd bool // When true, process workers are retired immediately after their last session ends. |
| 51 | HandoverDrainTimeout time.Duration // How long to wait for connections to drain during upgrade. 0 = unbounded (wait until k8s SIGKILL via terminationGracePeriodSeconds). Default: 0 in remote mode (so a CP rolling out doesn't kill in-flight customer queries at a self-imposed wall — see drainAndShutdown), 24h in process mode. |
| 52 | MetricsServer *http.Server // Optional metrics server to shut down during upgrade |
| 53 | |
| 54 | AdmissionReclaimerMaxReservations int // Max queued/live admission identities whose cleanup ownership this CP may retain (default: 4096) |
| 55 | |
| 56 | // WorkerBackend selects the worker management backend. |
| 57 | // "process" (default): workers are local child processes communicating over Unix sockets. |
| 58 | // "remote": Kubernetes-backed multitenant workers communicating over TCP. |
| 59 | // Requires ConfigStoreConn and a binary built with -tags kubernetes. |
| 60 | WorkerBackend string |
| 61 | |
| 62 | // K8s contains Kubernetes-specific configuration. Only used for remote |
| 63 | // multitenant mode. |
| 64 | K8s K8sConfig |
| 65 | |
| 66 | // ConfigStoreConn is the PostgreSQL connection string for the config store. |
| 67 | // Required when WorkerBackend == "remote". |
| 68 | ConfigStoreConn string |
| 69 | |
| 70 | // ConfigPollInterval is how often to poll the config store for changes. |
| 71 | // Default: 30s. |
| 72 | ConfigPollInterval time.Duration |
| 73 | |
| 74 | // InternalSecret is the shared secret for API authentication. |
| 75 | // When empty, a random secret is generated and logged at startup. |
| 76 | InternalSecret string |
| 77 | |
| 78 | // InternalSecretFallbacks are previous internal secrets still accepted |
| 79 | // for API authentication during a rotation (newest first). Clients always |
| 80 | // send the primary InternalSecret; the server accepts any of |
| 81 | // {primary ∪ fallbacks}. Mirrors posthog's SECRET_KEY_FALLBACKS. |
| 82 | InternalSecretFallbacks []string |
| 83 | |
| 84 | // ReadOnlySecret is a read-only secret accepted ONLY on the discovery |
| 85 | // endpoints (GET /api/v1/warehouses, GET /api/v1/warehouse-team-ids), so |
| 86 | // external writers (millpond, viaduck) don't have to carry the |
| 87 | // admin-capable InternalSecret. It never grants access to any other |
| 88 | // route. Empty disables the scoped path; the InternalSecret keeps |
| 89 | // working on the discovery endpoints either way (operator/debug access |
| 90 | // and rotation-window compatibility). |
| 91 | ReadOnlySecret string |
| 92 |
nothing calls this directly
no outgoing calls
no test coverage detected