Repository navigation
fix(seaweedfs): remove identities left behind by deleted BucketAccesses - #4915
Open
Aleksei Sviridkin (lexfrei) wants to merge 1 commit into
Open
Aleksei Sviridkin (lexfrei) wants to merge 1 commit into
Aleksei Sviridkin (lexfrei) wants to merge 1 commit into
Conversation
Aleksei Sviridkin (lexfrei)
requested review from
Andrei Kvapil (kvaps),
Timofei Larkin (lllamnyp) and
myasnikovdaniil
as code owners
October 14, 2026 08:24
Aleksei Sviridkin (lexfrei)
requested review from
IvanHunters,
mattia-eleuteri and
Kirill Ilin (sircthulhu)
as code owners
October 14, 2026 08:24
Contributor
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the
|
Aleksei Sviridkin (lexfrei)
force-pushed
the
fix/seaweedfs-cosi-object-lock
branch
from
November 12, 2026 19:59
d6394a3 to
93140bf
Compare
Aleksei Sviridkin (lexfrei)
force-pushed
the
fix/seaweedfs-cosi-orphan-identities
branch
2 times, most recently
from
November 12, 2026 21:15
0f80143 to
2720c6f
Compare
Aleksei Sviridkin (lexfrei)
force-pushed
the
fix/seaweedfs-cosi-orphan-identities
branch
from
November 12, 2026 21:30
2720c6f to
7524e38
Compare
Aleksei Sviridkin (lexfrei)
force-pushed
the
fix/seaweedfs-cosi-object-lock
branch
from
November 12, 2026 23:07
93140bf to
9fa5d64
Compare
Aleksei Sviridkin (lexfrei)
force-pushed
the
fix/seaweedfs-cosi-orphan-identities
branch
from
November 13, 2026 02:27
7524e38 to
1ac469a
Compare
Since SeaweedFS 4.08 the S3 gateways move every identity from /etc/iam/identity.json into /etc/iam/identities/<name>.json, and the COSI driver up to v0.3.1 revokes only from identity.json. Every BucketAccess deleted on such a filer left its identity file behind, with its keys still accepted (seaweedfs/seaweedfs-cosi-driver#11). A driver that deletes the file on revoke does nothing for the files already left. A post-install/post-upgrade hook removes a ba-<uid>.json file when no BucketAccess in any namespace names it, by uid or by status.accountID. The uid covers a BucketAccess still being granted, the accountID one restored with its status. The identity directory is listed before the BucketAccesses: a BucketAccess exists before its grant writes a file, so a file seen in the first listing whose BucketAccess still exists is always named by the second. File ages are not used, because grants and gateway migrations rewrite left-over files as well. A failed or empty listing removes nothing. Each removal is logged and recorded as an Event on the HelmRelease. The hook runs before the Object Lock hook, so a left-over identity is removed before that hook grants it anything. A filer published for Client-topology clusters holds identities whose BucketAccesses live in those clusters, so cosi.orphanIdentities defaults to auto: report there, delete otherwise. An operator can force either. Assisted-by: LLM Signed-off-by: Aleksei Sviridkin <[email protected]>
Aleksei Sviridkin (lexfrei)
force-pushed
the
fix/seaweedfs-cosi-orphan-identities
branch
from
November 13, 2026 05:46
1ac469a to
87d25b3
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 this PR does
Removes SeaweedFS identities left behind by deleted BucketAccesses. The COSI driver up to v0.3.1 revokes only from the legacy
identity.json, while SeaweedFS since 4.08 keeps each identity in its own file, so those files stayed (seaweedfs/seaweedfs-cosi-driver#11). The upstream driver v0.4.0 from #5284 deletes the file on revoke, so no new files are left. Files that v0.3.1 already left behind still hold working keys and stay until something removes them.A post-install/post-upgrade hook in
seaweedfs-systemremoves them. It lists the identity files before the BucketAccesses, so a file whose BucketAccess still exists is never taken for a left-over one. The rest of the rules are in the commit message and at the top of the script. When it is unsure, it removes nothing, and the errors it handles do not fail the release.A filer that other clusters use through Client topology holds identities whose BucketAccesses this cluster cannot see. The new
cosi.orphanIdentitiesvalue of the SeaweedFS application decides what happens there. The defaultautoonly reports whenfiler.grpcHostis set and removes otherwise, and an operator can forcereportordelete.Stacked on #4893.
Tested with bats against a fake
weed shelland with helm-unittest. A mutation that swaps the two listings back makes the ordering test fail. An earlier revision of the script, which also skipped recently changed files, was tried on a live cluster with SeaweedFS 4.45 and driver v0.3.1. It only reported in report mode and removed left-over files in delete mode while live identities kept working. With BucketAccess listing forbidden, it removed nothing. The current revision has not been run on a live cluster. No run has checked that the keys of a removed identity are then rejected.On 87d25b3 the bats, chart tests, Helm lint of the system chart and shellcheck pass offline. The Linux unit lane and E2E are pending.
Screenshots
Not a UI change.
Downstream repositories
The new value belongs to the SeaweedFS application, which the Terraform provider does not model (it only sets
seaweedfson a Tenant). The website reference page is regenerated from the README on release.Release note