Skip to content

fix(seaweedfs): remove identities left behind by deleted BucketAccesses - #4915

Open
Aleksei Sviridkin (lexfrei) wants to merge 1 commit into
fix/seaweedfs-cosi-object-lockfrom
fix/seaweedfs-cosi-orphan-identities
Open

Aleksei Sviridkin (lexfrei) wants to merge 1 commit into
fix/seaweedfs-cosi-object-lockfrom
fix/seaweedfs-cosi-orphan-identities

Conversation

@lexfrei

Copy link
Copy Markdown
Contributor

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 driver built in #4893 deletes the file on revoke, but files already left behind stay until something removes them.

A post-install/post-upgrade hook in seaweedfs-system removes them. The rules for what it deletes are in the commit message and at the top of the script. When it is unsure, it removes nothing, and nothing it runs into fails the release.

A filer that other clusters use through Client topology holds identities whose BucketAccesses this cluster cannot see. The new cosi.orphanIdentities value of the SeaweedFS application decides what happens there. The default auto only reports when filer.grpcHost is set and removes otherwise, and an operator can force report or delete.

Stacked on #4893.

Tested with bats against a fake weed shell and with helm-unittest, including mutations of every condition that guards a removal. On a live cluster with SeaweedFS 4.45 and driver v0.3.1, the hook skipped a fresh file, 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.

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 seaweedfs on a Tenant). The website reference page is regenerated from the README on release.

Release note

fix(seaweedfs): remove S3 identities left behind by deleted BucketAccesses on install and upgrade. The new cosi.orphanIdentities value (auto, report, delete) controls it; auto only reports on a filer published to Client-topology clusters.

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, and the file has not changed for ten minutes. The
uid covers a BucketAccess still being granted, the accountID one
restored with its status, and the age a grant in flight. A failed or
empty listing removes nothing. Each removal is logged and recorded as
an Event on the HelmRelease.

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 <f@lex.la>
@github-actions github-actions Bot added size/XL This PR changes 500-999 lines, ignoring generated files area/storage Issues or PRs related to storage (linstor, seaweedfs, bucket, velero, harbor) kind/bug Categorizes issue or PR as related to a bug labels Oct 14, 2026
@coderabbitai

coderabbitai Bot commented Oct 14, 2026

Copy link
Copy Markdown
Contributor

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration
  • Configuration used: Repository: cozystack/cozystack/.coderabbit.yaml
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 845a5f78-751e-4d6a-bc3c-b8f2297c4c37

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/storage Issues or PRs related to storage (linstor, seaweedfs, bucket, velero, harbor) kind/bug Categorizes issue or PR as related to a bug size/XL This PR changes 500-999 lines, ignoring generated files

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant