feat(admin): add service control and site replication commands#257
Merged
Conversation
cca22c5 to
6e78cfe
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Adds the two admin command families that
rcwas missing relative tomc, as reported in rustfs/backlog#1156 (comment 4968601053):rc admin service <restart|stop|freeze|unfreeze> <ALIAS>— maps toPOST /rustfs/admin/v3/service?action=<action>.restartandstoptrigger a graceful shutdown (the server response explicitly states that a process manager is responsible for relaunch afterrestart);freeze/unfreezepass through the server's advisoryeffective: falseflag honestly.rc admin replicate <add|info|status|remove> <ALIAS>...— maps to/rustfs/admin/v3/site-replication/{add,info,status,remove}. Peer sites foraddare given as configured alias names and resolved to endpoint + credentials from the local alias store, mirroringmc admin replicate addergonomics.statussupports--buckets/--users/--groups/--policies/--metricssection flags and defaults to the four summary sections likemc.Wire types (
PeerSiteSpec,SiteRemoveSpec,ServiceActionResult) mirror the server'scrates/madmindefinitions, including the MinIO-compatendpointsfield name quirk onPeerSite. The native/rustfs/adminprefix accepts plain JSON, so everything reuses the existing SigV4AdminClientrequest path — no madmin payload encryption needed.Why
The rustfs/backlog#1156 analysis found operators must fall back to
mcfor site replication and to SSH + systemctl for service control. Notably,mc admin service stopis broken against RustFS regardless (mc streaming-signs the POST withoutcontent-length, whichs3srejects atsignature.rs:445before any handler runs), so a nativerccommand 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.mdcontract gains new sections for the new commands.Verification
cargo fmt --allclean,cargo clippy --workspace --all-targets -- -D warningszero warnings,cargo test --workspaceall green (13 new integration tests inadmin_service.rs/admin_replicate.rsfollowing the existingadmin_supportmock-server pattern).main(ea2e24ac1) instances (withRUSTFS_REPLICATION_ALLOW_LOOPBACK_TARGET=truefor loopback endpoints):rc admin replicate add site1 site2→ cluster established; buckets, objects, and IAM users created on site1 replicated to site2 (verified viarc cat site2/...andrc admin user list site2).rc admin replicate status site1→ sites + replicated entity counts;remove --alldissolves the cluster; state survives server restarts.rc admin service stop/restart→ server logsRustFS server stoppedand the process exits gracefully;freeze/unfreezereport advisory status.mc admin replicate info(MinIO compat path) reads the cluster created byrc.Follow-ups (not in this PR)
rc admin replicate edit/resync/repairsubcommands (server endpoints already exist).info/statusinstead ofserde_json::Valuepassthrough, once the output shape is settled.Closes the
rcgap 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 addedserviceandreplicatecommands. The contract change is purely additive: no existing command, option, output schema, or exit code is modified.