hand agents the queue address at container start
HIVE_AGENT_NATS_URL now reaches each container in its hive facts, from the host's deploy.hive-controller.queue.agentNatsUrl, instead of being rendered into the meta flake. The agent option services.hyperhive.agent.queue.natsUrl is removed; the harness unit imports the queue credential whenever the token endpoint is set. On deploy every agent rebuilds once (the rendered flake loses the address), and the harness reads the address from the facts file hive-priv writes before each start. Refs #4857
This commit is contained in:
parent
ba97c64dda
commit
f3c0a87c0f
13 changed files with 54 additions and 31 deletions
|
|
@ -402,6 +402,13 @@ fn render_hive_facts(facts: &HiveFacts) -> Result<String> {
|
|||
1024,
|
||||
&|b: u8| dns(b) || matches!(b, b'=' | b',' | b'/' | b':' | b'%' | b'+' | b'@'),
|
||||
),
|
||||
// `<scheme>://<host>:<port>`.
|
||||
(
|
||||
"HIVE_AGENT_NATS_URL",
|
||||
facts.agent_nats_url.as_ref(),
|
||||
253,
|
||||
&|b: u8| dns(b) || matches!(b, b':' | b'/'),
|
||||
),
|
||||
] {
|
||||
let Some(value) = value else { continue };
|
||||
if value.is_empty() || value.len() > max_len || !value.bytes().all(allowed) {
|
||||
|
|
@ -774,8 +781,8 @@ mod tests {
|
|||
}
|
||||
}
|
||||
|
||||
/// The three per-host values agents used to get at build time arrive
|
||||
/// here, one line each.
|
||||
/// The per-host values agents used to get at build time arrive here, one
|
||||
/// line each.
|
||||
#[test]
|
||||
fn hive_facts_render_the_per_host_values() {
|
||||
let facts = HiveFacts {
|
||||
|
|
@ -784,13 +791,15 @@ mod tests {
|
|||
otel_extra_resource_attributes: Some(
|
||||
"deployment.environment=prod,team=a%2Fb".to_owned(),
|
||||
),
|
||||
agent_nats_url: Some("tls://nats.example.test:4222".to_owned()),
|
||||
..HiveFacts::default()
|
||||
};
|
||||
assert_eq!(
|
||||
render_hive_facts(&facts).unwrap(),
|
||||
"HIVE_DASHBOARD_PORT=7123\n\
|
||||
HYPERHIVE_CLAUDE_CODE_PATH=/nix/store/0abc-claude-code-2.1.220\n\
|
||||
HYPERHIVE_OTEL_EXTRA_RESOURCE_ATTRIBUTES=deployment.environment=prod,team=a%2Fb\n"
|
||||
HYPERHIVE_OTEL_EXTRA_RESOURCE_ATTRIBUTES=deployment.environment=prod,team=a%2Fb\n\
|
||||
HIVE_AGENT_NATS_URL=tls://nats.example.test:4222\n"
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue