drop the applied repo: the hive keeps no copy of an agent's config, only the deploy markers. Refs #5913
This commit is contained in:
parent
deeb5ecd86
commit
862495530c
3 changed files with 190 additions and 1634 deletions
|
|
@ -68,7 +68,7 @@ pub(super) trait Host: Sync {
|
|||
async fn notify(&self, key: String, summary: String);
|
||||
/// Re-read the agent's archetype from the swarm.
|
||||
async fn refresh_archetype(&self, name: &str) -> Result<()>;
|
||||
/// Rebuild preamble: port check, applied repo and state dirs.
|
||||
/// Rebuild preamble: port check and state dirs.
|
||||
async fn prepare_rebuild_dirs(&self, name: &str, paths: &AgentPaths) -> Result<()>;
|
||||
/// Rewrite the host-side files that follow the agent set.
|
||||
async fn refresh_agent_set(&self) -> Result<()>;
|
||||
|
|
@ -216,13 +216,11 @@ impl Host for RealHost {
|
|||
|
||||
fn purge_dirs(&self, name: &str) -> Vec<PathBuf> {
|
||||
// A malformed name can't have a persistent state tree (the state dir is
|
||||
// only ever created under a validated Ident), so only the applied dir
|
||||
// is left to clear.
|
||||
// only ever created under a validated Ident), so there is nothing to clear.
|
||||
hive_types::Ident::parse(name)
|
||||
.ok()
|
||||
.map(|id| crate::paths::agent_state_dir(&id))
|
||||
.into_iter()
|
||||
.chain([crate::paths::applied_dir(name)])
|
||||
.collect()
|
||||
}
|
||||
|
||||
|
|
@ -426,7 +424,7 @@ async fn run_purge_state(host: &impl Host, agent: &str) {
|
|||
// The state root may be a btrfs subvolume: a subvolume root can't be
|
||||
// removed with rmdir/`remove_dir_all`, so delete it via hive-priv (root)
|
||||
// first. No-op for plain-dir agents — the loop below then handles the
|
||||
// plain-dir state root plus the applied dir.
|
||||
// plain-dir state root.
|
||||
if let Err(e) = host.delete_state_subvolume(agent).await {
|
||||
tracing::warn!(error = ?e, %agent, "purge: delete state subvolume failed");
|
||||
}
|
||||
|
|
@ -731,8 +729,8 @@ async fn run_rebuild_bookkeeping(
|
|||
Ok(())
|
||||
}
|
||||
|
||||
/// First-spawn pre-create provisioning: the applied repo, state
|
||||
/// subvolume, and the agent-set refresh.
|
||||
/// First-spawn pre-create provisioning: the state subvolume and the
|
||||
/// agent-set refresh.
|
||||
async fn run_provision(host: &impl Host, name: &str) -> Result<()> {
|
||||
let agent_dir = crate::paths::agent_runtime_dir(name);
|
||||
let paths = Coordinator::agent_paths(name, agent_dir)?;
|
||||
|
|
|
|||
|
|
@ -51,7 +51,7 @@ pub enum NodeKind {
|
|||
DestroyContainer { agent: String },
|
||||
/// The `purge = true` half of a destroy: delete the agent's state
|
||||
/// subvolume (via hive-priv, since a subvolume root defeats
|
||||
/// `remove_dir_all`) plus its state and applied dirs.
|
||||
/// `remove_dir_all`) plus its state dir.
|
||||
PurgeState { agent: String },
|
||||
/// The post-destroy bookkeeping tail.
|
||||
DestroyBookkeeping { agent: String },
|
||||
|
|
|
|||
|
|
@ -282,7 +282,7 @@ pub fn rebuild(builder: &JobBuilder, agent: &str) -> Vec<hive_jobq::NodeGuid> {
|
|||
}
|
||||
|
||||
/// First deploy of an agent this hive has never seen, asked for by the swarm:
|
||||
/// `Provision` (applied repo, state subvolume, agent-set registration)
|
||||
/// `Provision` (state subvolume, agent-set registration)
|
||||
/// then `Create` (`nixos-container create`), drop-in write, then `Reconcile`
|
||||
/// starts the container (`wanted = Up`, seeded by
|
||||
/// `swarm_status::queue_first_deploy`). All-or-nothing: `Provision`
|
||||
|
|
|
|||
Loading…
Reference in a new issue