mirror of
https://github.com/warmbly/warmbly.git
synced 2026-09-13 00:03:42 +00:00
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:
+12
-1
@@ -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".
|
||||
|
||||
Reference in New Issue
Block a user