swarmctl: drop agent mint-identity and its controller route
Re-creating an agent mints its store identity the same way, so the
backfill verb and the `POST /api/agents/{name}/identity` route that only
it called go. The `MintAgentIdentity` job node stays: agent creation and
the renewal pass still queue it.
Part of #4765 (c).
This commit is contained in:
parent
cf763da178
commit
207484dfa6
7 changed files with 6 additions and 302 deletions
|
|
@ -237,22 +237,6 @@ enum AgentVerb {
|
|||
/// No approval gate guards this: the caller is root on the controller's
|
||||
/// host, or logged in through the swarm domain's SSO gate.
|
||||
Create(AgentCreateArgs),
|
||||
/// Queue a re-mint of an existing agent's identity at the swarm's
|
||||
/// secret store.
|
||||
///
|
||||
/// **The backfill verb.** Agent creation is event-driven and nothing at
|
||||
/// swarm level sweeps for agents that are missing a credential, so an
|
||||
/// agent created before a credential joined the mint never receives one.
|
||||
/// This re-runs the mint for one agent that already exists.
|
||||
///
|
||||
/// ⚠️ **It re-mints the agent's store certificate**, which that agent
|
||||
/// picks up the next time its container boots. It leaves an existing
|
||||
/// queue secret exactly as it stands, so running this against an
|
||||
/// already-migrated agent doesn't disturb its queue connection.
|
||||
///
|
||||
/// Queues and returns, the same way `agent create` does — watch the
|
||||
/// swarm UI's job view for the outcome.
|
||||
MintIdentity(AgentMintIdentityArgs),
|
||||
/// Check one agent's forge token, and mint it if it's missing or stale.
|
||||
///
|
||||
/// swarm-controller does this for every agent with a store identity at
|
||||
|
|
@ -353,19 +337,6 @@ struct AgentMintForgeTokenArgs {
|
|||
controller_socket: Option<PathBuf>,
|
||||
}
|
||||
|
||||
#[derive(Args)]
|
||||
struct AgentMintIdentityArgs {
|
||||
/// Name of an agent that already exists.
|
||||
name: String,
|
||||
/// swarm-controller's unix socket.
|
||||
///
|
||||
/// Supplied by the nix module that installs this binary, from the same
|
||||
/// `socketPath` option the daemon binds; falls back to
|
||||
/// `SWARM_CONTROLLER_SOCKET`.
|
||||
#[arg(long, value_name = "PATH")]
|
||||
controller_socket: Option<PathBuf>,
|
||||
}
|
||||
|
||||
#[derive(Subcommand)]
|
||||
enum ForgeVerb {
|
||||
/// Make an existing forge user a site admin.
|
||||
|
|
@ -589,13 +560,6 @@ fn main() -> Result<()> {
|
|||
agent::create(&target, &args.name, &args.hive)
|
||||
}
|
||||
// Same socket-resolution reasoning as `Create` above.
|
||||
Verb::Agent {
|
||||
command: AgentVerb::MintIdentity(args),
|
||||
} => {
|
||||
let target = remote.target(args.controller_socket)?;
|
||||
agent::mint_identity(&target, &args.name)
|
||||
}
|
||||
// Same socket-resolution reasoning as `Create` above.
|
||||
Verb::Agent {
|
||||
command: AgentVerb::MintForgeToken(args),
|
||||
} => {
|
||||
|
|
@ -1141,32 +1105,6 @@ mod tests {
|
|||
assert!(args.controller_socket.is_none());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn the_backfill_verb_takes_an_agent_and_no_hive() {
|
||||
let cli = Cli::try_parse_from(["swarmctl", "agent", "mint-identity", "scribe"])
|
||||
.expect("the minimal form parses");
|
||||
let Verb::Agent {
|
||||
command: AgentVerb::MintIdentity(args),
|
||||
} = cli.command
|
||||
else {
|
||||
panic!("expected `agent mint-identity`");
|
||||
};
|
||||
assert_eq!(args.name, "scribe");
|
||||
assert!(args.controller_socket.is_none());
|
||||
assert!(
|
||||
Cli::try_parse_from([
|
||||
"swarmctl",
|
||||
"agent",
|
||||
"mint-identity",
|
||||
"scribe",
|
||||
"--hive",
|
||||
"a"
|
||||
])
|
||||
.is_err(),
|
||||
"the identity has no hive, so the verb must not take one"
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn the_forge_token_verb_takes_an_agent_and_no_hive() {
|
||||
let cli = Cli::try_parse_from(["swarmctl", "agent", "mint-forge-token", "scribe"])
|
||||
|
|
|
|||
Loading…
Reference in a new issue