feat: settle on WARMBLY_NODE_REGION as the one region variable for every role, because the join script wrote it while the worker still read WORKER_REGION, so a joined worker reported no region and the placement geography term stayed dead for exactly the machines that had been given one

This commit is contained in:
Matthew Meszaros
2026-09-09 05:04:55 -07:00
parent de60bc3784
commit 704fecdcc0
6 changed files with 19 additions and 8 deletions
+12 -1
View File
@@ -239,7 +239,7 @@ func newNodeAgent(workerID uuid.UUID, bindIP string) *nodeagent.Agent {
NodeID: workerID,
Role: models.NodeRoleWorker,
Name: os.Getenv("WARMBLY_NODE_NAME"),
Region: os.Getenv("WORKER_REGION"),
Region: nodeRegion(),
Address: reportedIP,
Version: buildVersion(),
BaseURL: os.Getenv("ENCRYPTED_KEYS_BACKEND_URL"),
@@ -249,6 +249,17 @@ func newNodeAgent(workerID uuid.UUID, bindIP string) *nodeagent.Agent {
})
}
// nodeRegion reads the sign-in geography hint. WARMBLY_NODE_REGION is what the
// join script writes and what every role uses; WORKER_REGION is the older
// worker-only name, kept as a fallback so a machine configured by hand before
// the join flow existed keeps reporting its region.
func nodeRegion() string {
if v := os.Getenv("WARMBLY_NODE_REGION"); v != "" {
return v
}
return os.Getenv("WORKER_REGION")
}
// buildVersion is the image tag this build reports. Set by the join script
// from the tag it pulled; empty means unknown, which the control plane must
// not read as "needs updating".