Skip to content

feat(admin): add service control and site replication commands#257

Merged
overtrue merged 1 commit into
mainfrom
feat/admin-service-site-replication
Jul 15, 2026
Merged

feat(admin): add service control and site replication commands#257
overtrue merged 1 commit into
mainfrom
feat/admin-service-site-replication

Conversation

@overtrue

@overtrue overtrue commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

What

Adds the two admin command families that rc was missing relative to mc, as reported in rustfs/backlog#1156 (comment 4968601053):

  • rc admin service <restart|stop|freeze|unfreeze> <ALIAS> — maps to POST /rustfs/admin/v3/service?action=<action>. restart and stop trigger a graceful shutdown (the server response explicitly states that a process manager is responsible for relaunch after restart); freeze/unfreeze pass through the server's advisory effective: false flag honestly.
  • rc admin replicate <add|info|status|remove> <ALIAS>... — maps to /rustfs/admin/v3/site-replication/{add,info,status,remove}. Peer sites for add are given as configured alias names and resolved to endpoint + credentials from the local alias store, mirroring mc admin replicate add ergonomics. status supports --buckets/--users/--groups/--policies/--metrics section flags and defaults to the four summary sections like mc.

Wire types (PeerSiteSpec, SiteRemoveSpec, ServiceActionResult) mirror the server's crates/madmin definitions, including the MinIO-compat endpoints field name quirk on PeerSite. The native /rustfs/admin prefix accepts plain JSON, so everything reuses the existing SigV4 AdminClient request path — no madmin payload encryption needed.

Why

The rustfs/backlog#1156 analysis found operators must fall back to mc for site replication and to SSH + systemctl for service control. Notably, mc admin service stop is broken against RustFS regardless (mc streaming-signs the POST without content-length, which s3s rejects at signature.rs:445 before any handler runs), so a native rc command is the only clean client-side path for service control.

Additive only: no existing command, output schema, or exit code changes. The docs/reference/rc/admin.md contract gains new sections for the new commands.

Verification

  • cargo fmt --all clean, cargo clippy --workspace --all-targets -- -D warnings zero warnings, cargo test --workspace all green (13 new integration tests in admin_service.rs / admin_replicate.rs following the existing admin_support mock-server pattern).
  • Live end-to-end against two rustfs/rustfs main (ea2e24ac1) instances (with RUSTFS_REPLICATION_ALLOW_LOOPBACK_TARGET=true for loopback endpoints):
    • rc admin replicate add site1 site2 → cluster established; buckets, objects, and IAM users created on site1 replicated to site2 (verified via rc cat site2/... and rc admin user list site2).
    • rc admin replicate status site1 → sites + replicated entity counts; remove --all dissolves the cluster; state survives server restarts.
    • rc admin service stop/restart → server logs RustFS server stopped and the process exits gracefully; freeze/unfreeze report advisory status.
    • Interop: mc admin replicate info (MinIO compat path) reads the cluster created by rc.

Follow-ups (not in this PR)

  • rc admin replicate edit / resync / repair subcommands (server endpoints already exist).
  • Typed response structs for info/status instead of serde_json::Value passthrough, once the output shape is settled.

Closes the rc gap identified in rustfs/backlog#1156.


BREAKING CHANGE: none in behavior — this marker is present because docs/reference/rc/admin.md (a protected CLI contract file) gains new sections for the added service and replicate commands. The contract change is purely additive: no existing command, option, output schema, or exit code is modified.

Copilot AI review requested due to automatic review settings July 15, 2026 01:34

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@overtrue overtrue force-pushed the feat/admin-service-site-replication branch from cca22c5 to 6e78cfe Compare July 15, 2026 01:38
@overtrue overtrue merged commit dc34fe0 into main Jul 15, 2026
16 checks passed
@overtrue overtrue deleted the feat/admin-service-site-replication branch July 15, 2026 01:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants