mirror of
https://github.com/cozystack/cozystack.git
synced 2026-11-21 12:13:55 +09:00
<!-- Thank you for making a contribution! Here are some tips for you: - Use Conventional Commits for the PR title: `type(scope): description` - Types: feat, fix, security (a fix that comes through a security advisory), docs, style, refactor, perf, test, build, ci, chore - Scopes are not an exhaustive list — pick the most specific scope for the change and extend the list when a genuinely new area appears. Examples: - System components: dashboard, platform, operator, cilium, kube-ovn, linstor, fluxcd, cluster-api - Managed apps: postgres, mariadb, redis, kafka, clickhouse, virtual-machine, kubernetes - Development and maintenance: api, hack, tests, ci, docs, maintenance - Breaking changes: append `!` after type/scope (`feat(api)!: ...`) or add a `BREAKING CHANGE:` footer - If it's a work in progress, consider creating this PR as a draft. - Don't hesistate to ask for opinion and review in the community chats, even if it's still a draft. - Fixes merged to `main` reach the release lines the backport batch runs for automatically, so do not open backport PRs by hand: https://github.com/cozystack/cozystack/blob/main/docs/release/backports.md --> ## What this PR does Adds `publicRead` to the Bucket application. A bucket cannot serve its objects without a signature today: every BucketAccess issues a key, and those keys grant neither `WriteAcp` nor `PutBucketPolicy`, so `aws s3api put-bucket-acl --acl public-read` is refused and a tenant has no way to serve static assets (images, downloads) straight from a bucket. The only workaround is an operator running `weed shell` `s3.anonymous.set` by hand, which nothing reconciles and which outlives the bucket. With `publicRead: true` the chart renders one more BucketAccess, `<bucket>-public-read`, on a new `-public` BucketAccessClass whose `accessPolicy` is `public-read`. The class is added in the three places that define access classes: the Client topology, the per-storage-pool classes, and the vendored chart (through its existing `cosi-bucket-class-lock-readonly.patch`). The COSI driver handles the policy by adding `Read:<bucket>` to the gateway's `anonymous` identity and, on revoke, removing only that action, so turning the flag off or deleting the bucket closes it again without touching other public buckets. Anonymous callers can `GET`/`HEAD` objects at `<endpoint>/<bucket>/<key>`; listing and writes stay refused. A user named `public-read` would own the same BucketAccess name, so that combination fails to render with an explicit message rather than having two owners fight over one object. The seaweedfs pool name check now also reserves `public` and the `-public` suffix, next to the existing `-lock` and `-readonly`: a pool `<x>-public` would render a readwrite BucketAccessClass with the same name as pool `<x>`'s public-read class, and a pool `public` would take the instance's own `-public` class. This is a breaking change for an instance that already defines a pool with such a name: its seaweedfs release stops rendering with the pool name error. Pool keys are part of the volume server and PVC names, so renaming such a pool moves its data to new volumes; that migration is the operator's to plan before upgrading. **Known limitation until the next driver release.** On v0.5.0, revoking public read (turning `publicRead` off or deleting the bucket) can leave the bucket readable anonymously if an S3 gateway migrates `identity.json` while the revoke is in flight: the migrated `identities/anonymous.json` keeps `Read:<bucket>`, and SeaweedFS loads it over `identity.json` without ever repairing it. The fix is seaweedfs/seaweedfs-cosi-driver#22 (the revoke always writes `anonymous.json`, after the legacy file). The driver release carrying it will be pinned here if it lands before this PR merges, otherwise in a follow-up. Until then, an operator can check `s3.anonymous.list` in `weed shell` after a revoke and clear a leftover with `s3.anonymous.set -bucket <bucket> -access none`. **Driver: pins the upstream seaweedfs-cosi-driver v0.5.0.** The `public-read` policy merged upstream in seaweedfs/seaweedfs-cosi-driver#21 and v0.5.0 is tagged on that merge, so this PR moves the image pin from v0.4.0 (#5284) to v0.5.0 in `packages/system/seaweedfs/values.yaml`, the client-mode `.tag` file and `cosi_image_test.yaml`. An earlier revision of this branch built the driver in-tree while no release carried the policy; that build is gone, and the intermediate commits that added it are undone by the merge of `main`, so squashing leaves only the feature and the pin. v0.5.0 differs from v0.4.0 only by the `public-read` policy (seaweedfs/seaweedfs-cosi-driver#21) and its README note. Upstream documents one `public-read` BucketAccess per bucket as the supported shape, which is what the chart renders. Tested: new helm-unittest suites for the bucket app (default off, class name with and without storage pool, locked bucket, coexistence with users, the name collision), the seaweedfs extra chart (Client and storage-pool classes) and the vendored chart; they fail when the class suffix or the policy is removed. `helm unittest` passes on `packages/apps/bucket`, `packages/extra/seaweedfs`, `packages/system/seaweedfs` and `packages/system/bucket`, as do `test-guard-fail-closed` and `test-image-version`; `cosi_image_test.yaml` pins `ghcr.io/seaweedfs/seaweedfs-cosi-driver:v0.5.0`, which is published for amd64 and arm64. The anonymous-read mechanism itself was checked by hand on SeaweedFS 4.45 (`weed shell` `s3.anonymous.set -access Read`): anonymous `GET` returns 200 on both gateways, `ListObjects`/`ListObjectsV2` and `PUT` return 403, and the identity survives grants and revokes of regular BucketAccesses. The end-to-end path through the new driver has not run on a cluster yet. ### Screenshots No UI change. ### Downstream repositories <!-- Cozystack is upstream for repositories that are NOT kept in sync with it automatically, and nothing in CI compares the two sides, so a change here can break them silently. Which change forces what, and which file to touch, is the trigger map in docs/agents/contributing.md under "Downstream Repositories". Walk it before you tick anything. IF YOU ARE AN AI AGENT OR AN LLM, THIS IS PART OF THE TASK, NOT A FORM TO FILL IN: 1. Walk the trigger map against the actual diff of this PR, file by file. Do not decide from the PR title or from your memory of what you changed. 2. For every repository you tick, open the follow-up PR there and link it on the same line. A ticked box with no link claims work that does not exist, which is worse than an empty box. Search that repository for an open PR or issue covering it first, and link that instead of filing a duplicate. 3. When the follow-up is out of scope, or needs a decision that is not yours to make, open an issue in that repository instead, link that, and say so in the PR body. Do not push a speculative PR into another repository just to fill a line here. 4. Do not tick "No downstream repository is affected" to make the checklist go away. If you are unsure, leave every box empty and say so in the PR body, so a human decides. --> - [ ] No downstream repository is affected by this change - [ ] [cozystack/website](https://github.com/cozystack/website) - follow-up: - [x] [cozystack/terraform-provider-cozystack](https://github.com/cozystack/terraform-provider-cozystack) - follow-up: cozystack/terraform-provider-cozystack#80 - [ ] [cozystack/ansible-cozystack](https://github.com/cozystack/ansible-cozystack) - follow-up: - [ ] [cozystack/ccp](https://github.com/cozystack/ccp) - follow-up: - [ ] [cozystack/talm](https://github.com/cozystack/talm) - follow-up: - [ ] [cozystack/cozyhr](https://github.com/cozystack/cozyhr) - follow-up: - [ ] [cozystack/cozy-proxy](https://github.com/cozystack/cozy-proxy) - follow-up: - [ ] [cozystack/cozystack-telemetry-server](https://github.com/cozystack/cozystack-telemetry-server) - follow-up: - [ ] [cozystack/external-apps-example](https://github.com/cozystack/external-apps-example) - follow-up: - [ ] [cozystack/examples](https://github.com/cozystack/examples) - follow-up: - [ ] [cozystack/community](https://github.com/cozystack/community) - follow-up: Walked the trigger map against the diff: the only hit is the new field in `packages/apps/bucket/values.schema.json` (and `api/apps/v1alpha1/bucket/types.go`), which the Terraform provider models by hand. Follow-up filed as cozystack/terraform-provider-cozystack#80. The website's bucket page is hand-written and could mention the flag, but no listed trigger covers an added field, so it is left unticked. ### Release note <!-- Write a release note: - Explain what has changed internally and for users. - Start with the same `type(scope):` prefix as in the PR title - Follow the guidelines at https://github.com/kubernetes/community/blob/master/contributors/guide/release-notes.md. --> ```release-note feat(bucket): add `publicRead` to serve a bucket's objects without credentials at `<endpoint>/<bucket>/<key>`. Anonymous callers can read objects but cannot list the bucket or write to it. The COSI driver is bumped to seaweedfs-cosi-driver v0.5.0, which adds the `public-read` access policy. The seaweedfs pool names `public` and `*-public` are now reserved: an instance that already defines such a pool fails to render until the pool is renamed, which moves its data to new volumes. ``` <!-- This is an auto-generated comment: release notes by coderabbit.ai --> <!-- coderabbit-ai-generated:v1 --> ## Summary by CodeRabbit * **New Features** * Bucket configurations can enable anonymous reads of objects through the bucket endpoint. Anonymous access does not allow listing buckets or writing objects. * SeaweedFS provides public-read access classes across supported bucket configurations, alongside read-only and read-write access. * Added a retained bucket class with object locking and a 365-day compliance retention period. * **Documentation** * Added guidance for the `publicRead` setting, which is disabled by default. * **Updates** * Updated the SeaweedFS COSI driver to v0.5.0. Pool names `public` and names ending in `-public` are reserved. <!-- end of auto-generated comment: release notes by coderabbit.ai -->