feat(#1897): auto-fill the hive domain in peer-config (drop required --domain)
Per operator review: hivectl shouldn't make the operator retype this hive's own domain. Add a HostRequest::HiveDomain admin-socket query (c0re answers from HYPERHIVE_HIVE_DOMAIN, already in its service env) and a domain field on HostResponse. hivectl peer-config now resolves the domain as: --domain override (kept for offline/scripted use), else the daemon query; errors with a clear hint when neither resolves. wg init resolves it best-effort too, so it prints the hand-over peer-config block without --domain (skipped, not failed, when the daemon is unreachable). Regenerated docs/tools/hivectl-cli.md.
This commit is contained in:
parent
8464cb95cb
commit
72d9422a7a
4 changed files with 89 additions and 19 deletions
|
|
@ -44,6 +44,11 @@ pub enum HostRequest {
|
|||
Rebuild { name: String },
|
||||
/// List managed containers.
|
||||
List,
|
||||
/// Report this hive's canonical DNS domain
|
||||
/// (`services.hyperhive.domain`), or `None` when unset. Lets the
|
||||
/// operator CLI fill in the hive's own identity (e.g. the federation
|
||||
/// peer-config block) without the operator retyping it.
|
||||
HiveDomain,
|
||||
/// List pending approval requests.
|
||||
Pending,
|
||||
/// Approve a pending request by id; the action runs immediately.
|
||||
|
|
@ -131,6 +136,10 @@ pub struct HostResponse {
|
|||
pub agents: Option<Vec<String>>,
|
||||
#[serde(default, skip_serializing_if = "Option::is_none")]
|
||||
pub approvals: Option<Vec<Approval>>,
|
||||
/// This hive's canonical DNS domain — `HiveDomain` result. `None`
|
||||
/// when the domain is unset (no `services.hyperhive.domain`).
|
||||
#[serde(default, skip_serializing_if = "Option::is_none")]
|
||||
pub domain: Option<String>,
|
||||
}
|
||||
|
||||
/// One row in the approval queue. `commit_ref` is overloaded per
|
||||
|
|
@ -218,6 +227,7 @@ impl HostResponse {
|
|||
error: None,
|
||||
agents: None,
|
||||
approvals: None,
|
||||
domain: None,
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -228,6 +238,7 @@ impl HostResponse {
|
|||
error: Some(message.into()),
|
||||
agents: None,
|
||||
approvals: None,
|
||||
domain: None,
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -238,6 +249,7 @@ impl HostResponse {
|
|||
error: None,
|
||||
agents: Some(agents),
|
||||
approvals: None,
|
||||
domain: None,
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -248,6 +260,19 @@ impl HostResponse {
|
|||
error: None,
|
||||
agents: None,
|
||||
approvals: Some(approvals),
|
||||
domain: None,
|
||||
}
|
||||
}
|
||||
|
||||
/// `HiveDomain` result — this hive's canonical domain (or `None`).
|
||||
#[must_use]
|
||||
pub fn hive_domain(domain: Option<String>) -> Self {
|
||||
Self {
|
||||
ok: true,
|
||||
error: None,
|
||||
agents: None,
|
||||
approvals: None,
|
||||
domain,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue