feat(bucket)!: add publicRead to serve a bucket without credentials (#5252)

<!-- 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 -->
This commit is contained in:
Aleksei Sviridkin authored and GitHub committed 2026-11-13 18:47:57 +03:00
commit f61cfdf0b8
17 files changed
+306 -22

No files matched your search

+3
View File
@@ -25,6 +25,9 @@ type ConfigSpec struct {
// Deploys the web UI (s3manager) with its Service and its Ingress or HTTPRoute at `<bucket>.<tenant host>`. Set to `false` to run the bucket without them.
// +kubebuilder:default:=true
Ui bool `json:"ui"`
// Serves the bucket's objects to anyone without credentials at `<endpoint>/<bucket>/<key>`. Anonymous callers can read objects but cannot list the bucket or write to it.
// +kubebuilder:default:=false
PublicRead bool `json:"publicRead"`
// Users configuration map.
// +kubebuilder:default:={}
Users map[string]User `json:"users,omitempty"`
+8 -7
View File
@@ -4,11 +4,12 @@
### Parameters
| Name | Description | Type | Value |
| ---------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------- | ------- |
| `locking` | Provisions bucket from the `-lock` BucketClass (with object lock enabled). | `bool` | `false` |
| `storagePool` | Selects a specific BucketClass by storage pool name. | `string` | `""` |
| `ui` | Deploys the web UI (s3manager) with its Service and its Ingress or HTTPRoute at `<bucket>.<tenant host>`. Set to `false` to run the bucket without them. | `bool` | `true` |
| `users` | Users configuration map. | `map[string]object` | `{}` |
| `users[name].readonly` | Whether the user has read-only access. | `bool` | `false` |
| Name | Description | Type | Value |
| ---------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------- | ------- |
| `locking` | Provisions bucket from the `-lock` BucketClass (with object lock enabled). | `bool` | `false` |
| `storagePool` | Selects a specific BucketClass by storage pool name. | `string` | `""` |
| `ui` | Deploys the web UI (s3manager) with its Service and its Ingress or HTTPRoute at `<bucket>.<tenant host>`. Set to `false` to run the bucket without them. | `bool` | `true` |
| `publicRead` | Serves the bucket's objects to anyone without credentials at `<endpoint>/<bucket>/<key>`. Anonymous callers can read objects but cannot list the bucket or write to it. | `bool` | `false` |
| `users` | Users configuration map. | `map[string]object` | `{}` |
| `users[name].readonly` | Whether the user has read-only access. | `bool` | `false` |
@@ -22,3 +22,18 @@ spec:
credentialsSecretName: {{ $.Release.Name }}-{{ $name }}
protocol: s3
{{- end }}
{{- if .Values.publicRead }}
{{- if hasKey .Values.users "public-read" }}
{{- fail "publicRead creates the BucketAccess <bucket>-public-read, which the user \"public-read\" already owns: rename that user" }}
{{- end }}
---
apiVersion: objectstorage.k8s.io/v1alpha1
kind: BucketAccess
metadata:
name: {{ .Release.Name }}-public-read
spec:
bucketAccessClassName: {{ $seaweedfs }}{{- if $pool }}-{{ $pool }}{{- end }}-public
bucketClaimName: {{ .Release.Name }}
credentialsSecretName: {{ .Release.Name }}-public-read
protocol: s3
{{- end }}
@@ -0,0 +1,82 @@
suite: bucket publicRead
templates:
- templates/bucketclaim.yaml
release:
name: bucket-my-bucket
namespace: tenant-root
set:
_namespace:
seaweedfs: tenant-root
tests:
- it: renders no public BucketAccess by default
asserts:
- hasDocuments:
count: 1
- isKind:
of: BucketClaim
- it: renders a public-read BucketAccess on the -public class
set:
publicRead: true
documentSelector:
path: metadata.name
value: bucket-my-bucket-public-read
asserts:
- isKind:
of: BucketAccess
- equal:
path: spec.bucketAccessClassName
value: tenant-root-public
- equal:
path: spec.bucketClaimName
value: bucket-my-bucket
- equal:
path: spec.credentialsSecretName
value: bucket-my-bucket-public-read
- it: uses the storage pool's -public class
set:
publicRead: true
storagePool: fast
documentSelector:
path: metadata.name
value: bucket-my-bucket-public-read
asserts:
- equal:
path: spec.bucketAccessClassName
value: tenant-root-fast-public
- it: keeps the access class free of -lock on a locked bucket
set:
publicRead: true
locking: true
documentSelector:
path: metadata.name
value: bucket-my-bucket-public-read
asserts:
- equal:
path: spec.bucketAccessClassName
value: tenant-root-public
- it: keeps the users' BucketAccesses next to the public one
set:
publicRead: true
users:
app: {}
reader:
readonly: true
asserts:
- hasDocuments:
count: 4
- it: refuses a user that would own the public BucketAccess name
set:
publicRead: true
users:
public-read: {}
asserts:
- failedTemplate:
errorPattern: user "public-read" already owns
+5
View File
@@ -20,6 +20,11 @@
"type": "boolean",
"default": true
},
"publicRead": {
"description": "Serves the bucket's objects to anyone without credentials at `\u003cendpoint\u003e/\u003cbucket\u003e/\u003ckey\u003e`. Anonymous callers can read objects but cannot list the bucket or write to it.",
"type": "boolean",
"default": false
},
"users": {
"description": "Users configuration map.",
"type": "object",
+3
View File
@@ -8,6 +8,9 @@ storagePool: ""
## @param {bool} ui=true - Deploys the web UI (s3manager) with its Service and its Ingress or HTTPRoute at `<bucket>.<tenant host>`. Set to `false` to run the bucket without them.
ui: true
## @param {bool} publicRead=false - Serves the bucket's objects to anyone without credentials at `<endpoint>/<bucket>/<key>`. Anonymous callers can read objects but cannot list the bucket or write to it.
publicRead: false
## @typedef {struct} User - Bucket user configuration.
## @field {bool} [readonly] - Whether the user has read-only access.
@@ -1 +1 @@
ghcr.io/seaweedfs/seaweedfs-cosi-driver:v0.4.0
ghcr.io/seaweedfs/seaweedfs-cosi-driver:v0.5.0
@@ -35,4 +35,13 @@ driverName: {{ .Release.Namespace }}.seaweedfs.objectstorage.k8s.io
authenticationType: KEY
parameters:
accessPolicy: readonly
---
kind: BucketAccessClass
apiVersion: objectstorage.k8s.io/v1alpha1
metadata:
name: {{ .Release.Namespace }}-public
driverName: {{ .Release.Namespace }}.seaweedfs.objectstorage.k8s.io
authenticationType: KEY
parameters:
accessPolicy: public-read
{{- end }}
@@ -32,8 +32,8 @@
{{- if not (regexMatch "^[a-z0-9]([a-z0-9-]*[a-z0-9])?$" $poolName) }}
{{- fail (printf "volume.pools key '%s' must be a valid DNS label (lowercase alphanumeric and hyphens, no dots)." $poolName) }}
{{- end }}
{{- if or (hasSuffix "-lock" $poolName) (hasSuffix "-readonly" $poolName) }}
{{- fail (printf "volume.pools key '%s' must not end with '-lock' or '-readonly' (reserved suffixes for COSI resources)." $poolName) }}
{{- if or (hasSuffix "-lock" $poolName) (hasSuffix "-readonly" $poolName) (hasSuffix "-public" $poolName) (eq "public" $poolName) }}
{{- fail (printf "volume.pools key '%s' must not be 'public' or end with '-lock', '-readonly' or '-public' (reserved for COSI resources)." $poolName) }}
{{- end }}
{{- if not $pool.diskType }}
{{- fail (printf "volume.pools.%s.diskType is required." $poolName) }}
@@ -52,8 +52,8 @@
{{- if not (regexMatch "^[a-z0-9]([a-z0-9-]*[a-z0-9])?$" $poolName) }}
{{- fail (printf "volume.zones.%s.pools key '%s' must be a valid DNS label." $zoneName $poolName) }}
{{- end }}
{{- if or (hasSuffix "-lock" $poolName) (hasSuffix "-readonly" $poolName) }}
{{- fail (printf "volume.zones.%s.pools key '%s' must not end with '-lock' or '-readonly' (reserved suffixes for COSI resources)." $zoneName $poolName) }}
{{- if or (hasSuffix "-lock" $poolName) (hasSuffix "-readonly" $poolName) (hasSuffix "-public" $poolName) (eq "public" $poolName) }}
{{- fail (printf "volume.zones.%s.pools key '%s' must not be 'public' or end with '-lock', '-readonly' or '-public' (reserved for COSI resources)." $zoneName $poolName) }}
{{- end }}
{{- if not $pool.diskType }}
{{- fail (printf "volume.zones.%s.pools.%s.diskType is required." $zoneName $poolName) }}
@@ -51,5 +51,14 @@ driverName: {{ $.Release.Namespace }}.seaweedfs.objectstorage.k8s.io
authenticationType: KEY
parameters:
accessPolicy: readonly
---
kind: BucketAccessClass
apiVersion: objectstorage.k8s.io/v1alpha1
metadata:
name: {{ $.Release.Namespace }}-{{ $poolName }}-public
driverName: {{ $.Release.Namespace }}.seaweedfs.objectstorage.k8s.io
authenticationType: KEY
parameters:
accessPolicy: public-read
{{- end }}
{{- end }}
@@ -0,0 +1,113 @@
suite: seaweedfs public-read BucketAccessClass
release:
name: seaweedfs
namespace: tenant-root
set:
filer:
grpcHost: seaweedfs-filer.tenant-other.svc
_namespace:
host: example.org
ingress: tenant-root
_cluster:
issuer-name: letsencrypt-prod
solver: http01
tests:
- it: offers a -public access class to a Client instance
template: templates/client/cosi-bucket-class.yaml
set:
topology: Client
documentSelector:
path: metadata.name
value: tenant-root-public
asserts:
- isKind:
of: BucketAccessClass
- equal:
path: parameters.accessPolicy
value: public-read
- equal:
path: driverName
value: tenant-root.seaweedfs.objectstorage.k8s.io
- it: offers a -public access class per storage pool
template: templates/storage-pool-bucket-classes.yaml
set:
topology: Simple
volume:
pools:
fast:
diskType: ssd
documentSelector:
path: metadata.name
value: tenant-root-fast-public
asserts:
- isKind:
of: BucketAccessClass
- equal:
path: parameters.accessPolicy
value: public-read
# A pool named <x>-public would render a readwrite BucketAccessClass
# <ns>-<x>-public, the same name as pool <x>'s public-read class; a pool named
# public would take <ns>-public, the instance's own public-read class.
- it: refuses a pool name ending in -public
template: templates/seaweedfs.yaml
set:
volume:
pools:
fast:
diskType: ssd
fast-public:
diskType: nvme
asserts:
- failedTemplate:
errorPattern: volume.pools key 'fast-public' must not be 'public' or end with
- it: refuses a pool named public
template: templates/seaweedfs.yaml
set:
volume:
pools:
public:
diskType: ssd
asserts:
- failedTemplate:
errorPattern: volume.pools key 'public' must not be 'public' or end with
- it: refuses a zone pool name ending in -public
template: templates/seaweedfs.yaml
set:
topology: MultiZone
replicationFactor: 1
volume:
zones:
a:
pools:
fast-public:
diskType: ssd
asserts:
- failedTemplate:
errorPattern: volume.zones.a.pools key 'fast-public' must not be 'public' or end with
- it: still refuses a pool name ending in -readonly
template: templates/seaweedfs.yaml
set:
volume:
pools:
fast-readonly:
diskType: ssd
asserts:
- failedTemplate:
errorPattern: volume.pools key 'fast-readonly' must not be 'public' or end with
- it: accepts a pool name that only contains public
template: templates/seaweedfs.yaml
set:
volume:
pools:
publicfast:
diskType: ssd
asserts:
- notFailedTemplate: {}
+2 -2
View File
@@ -8,7 +8,7 @@ spec:
plural: buckets
singular: bucket
openAPISchema: |-
{"title":"Chart Values","type":"object","properties":{"locking":{"description":"Provisions bucket from the `-lock` BucketClass (with object lock enabled).","type":"boolean","default":false},"storagePool":{"description":"Selects a specific BucketClass by storage pool name.","type":"string","default":"","x-cozystack-options":{"source":"storagepool"}},"ui":{"description":"Deploys the web UI (s3manager) with its Service and its Ingress or HTTPRoute at `<bucket>.<tenant host>`. Set to `false` to run the bucket without them.","type":"boolean","default":true},"users":{"description":"Users configuration map.","type":"object","default":{},"additionalProperties":{"type":"object","properties":{"readonly":{"description":"Whether the user has read-only access.","type":"boolean"}}}}}}
{"title":"Chart Values","type":"object","properties":{"locking":{"description":"Provisions bucket from the `-lock` BucketClass (with object lock enabled).","type":"boolean","default":false},"storagePool":{"description":"Selects a specific BucketClass by storage pool name.","type":"string","default":"","x-cozystack-options":{"source":"storagepool"}},"ui":{"description":"Deploys the web UI (s3manager) with its Service and its Ingress or HTTPRoute at `<bucket>.<tenant host>`. Set to `false` to run the bucket without them.","type":"boolean","default":true},"publicRead":{"description":"Serves the bucket's objects to anyone without credentials at `<endpoint>/<bucket>/<key>`. Anonymous callers can read objects but cannot list the bucket or write to it.","type":"boolean","default":false},"users":{"description":"Users configuration map.","type":"object","default":{},"additionalProperties":{"type":"object","properties":{"readonly":{"description":"Whether the user has read-only access.","type":"boolean"}}}}}}
release:
prefix: bucket-
labels:
@@ -26,7 +26,7 @@ spec:
tags:
- storage
icon: PHN2ZyB3aWR0aD0iMTQ0IiBoZWlnaHQ9IjE0NCIgdmlld0JveD0iMCAwIDE0NCAxNDQiIGZpbGw9Im5vbmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+CjxyZWN0IHdpZHRoPSIxNDQiIGhlaWdodD0iMTQ0IiByeD0iMjQiIGZpbGw9InVybCgjcGFpbnQwX2xpbmVhcl82ODNfMzA5MSkiLz4KPHBhdGggZmlsbC1ydWxlPSJldmVub2RkIiBjbGlwLXJ1bGU9ImV2ZW5vZGQiIGQ9Ik03MiAzMC4xNjQxTDExNy45ODMgMzYuNzc4OVY0MC42NzM5QzExNy45ODMgNDYuNDY1MyA5Ny4zODYyIDUxLjEzMzIgNzEuOTgyNyA1MS4xMzMyQzQ2LjU3OTIgNTEuMTMzMiAyNiA0Ni40NjUzIDI2IDQwLjY3MzlWMzYuNDQzMUw3MiAzMC4xNjQxWk03MiA1OC4yNjc4QzkxLjIwODQgNTguMjY3OCAxMDcuNjU4IDU1LjU5ODYgMTE0LjU0NyA1MS44MDQ4TDExNi44MDMgNDguMTExTDExNy43MjMgNDQuNzUzVjQ4LjkxNzFMMTAyLjY3OSAxMTEuMDMzQzEwMi42NzkgMTE0Ljg5NSA4OC45NTMzIDExOCA3Mi4wMTcyIDExOEM1NS4wODEyIDExOCA0MS4zNzQzIDExNC44OTUgNDEuMzc0MyAxMTEuMDMzTDI2LjMzIDQ4LjkxNzFWNDQuODM2OUwyOS44MDA3IDUxLjkzODJDMzYuNzA2NSA1NS42NjUzIDUyLjk5OTcgNTguMjY3OCA3MiA1OC4yNjc4WiIgZmlsbD0iIzhDMzEyMyIvPgo8cGF0aCBmaWxsLXJ1bGU9ImV2ZW5vZGQiIGNsaXAtcnVsZT0iZXZlbm9kZCIgZD0iTTcyLjAwMDMgMjZDOTcuNDAzOCAyNiAxMTggMzAuNjgzOSAxMTggMzYuNDQyQzExOCA0Mi4yIDk3LjM4NjYgNDYuODUwNyA3Mi4wMDAzIDQ2Ljg1MDdDNDYuNjE0MSA0Ni44NTA3IDI2LjAxNzYgNDIuMjM0NSAyNi4wMTc2IDM2LjQ0MkMyNi4wMTc2IDMwLjY0OTQgNDYuNTk2OCAyNiA3Mi4wMDAzIDI2Wk03Mi4wMDAzIDU0LjEwMzdDOTUuNjg1NyA1NC4xMDM3IDExNS4xNzIgNTAuMDU4IDExNy43MDYgNDQuODE5N0wxMDIuNjYyIDEwNi45MzdDMTAyLjY2MiAxMTAuNzk5IDg4LjkzNjQgMTEzLjkwNSA3Mi4wMDAzIDExMy45MDVDNTUuMDY0MyAxMTMuOTA1IDQxLjMzOSAxMTAuODE2IDQxLjMzOSAxMDYuOTU0TDI2LjI5NTkgNDQuODM3QzI4Ljg0NjYgNTAuMDU4IDQ4LjMzMzMgNTQuMTAzNyA3Mi4wMDAzIDU0LjEwMzdaIiBmaWxsPSIjRTA1MjQzIi8+CjxwYXRoIGZpbGwtcnVsZT0iZXZlbm9kZCIgY2xpcC1ydWxlPSJldmVub2RkIiBkPSJNNjEuMTcyNSA2MC4wMjkzSDgxLjA5MjhWNzkuMTY3Nkg2MS4xNzI1VjYwLjAyOTNaTTQ1LjMzMDEgOTUuMzY4OEM0NS4zMzAxIDkwLjE0MiA0OS43MTA0IDg1LjkzNDIgNTUuMTUxMSA4NS45MzQyQzYwLjU5MTcgODUuOTM0MiA2NC45NzIxIDkwLjE0MiA2NC45NzIxIDk1LjM2ODhDNjQuOTcyMSAxMDAuNTk2IDYwLjU5MTcgMTA0LjgwMyA1NS4xNTExIDEwNC44MDNDNDkuNzEwNCAxMDQuODAzIDQ1LjMzMDEgMTAwLjU5NiA0NS4zMzAxIDk1LjM2ODhaTTk2LjQ0ODcgMTA0LjM2OEg3Ni43NzIyTDg2LjYxMDUgODYuNzczN0w5Ni40NDg3IDEwNC4zNjhaIiBmaWxsPSJ3aGl0ZSIvPgo8ZGVmcz4KPGxpbmVhckdyYWRpZW50IGlkPSJwYWludDBfbGluZWFyXzY4M18zMDkxIiB4MT0iMCIgeTE9IjAiIHgyPSIxNTEiIHkyPSIxODAiIGdyYWRpZW50VW5pdHM9InVzZXJTcGFjZU9uVXNlIj4KPHN0b3Agc3RvcC1jb2xvcj0iI0ZGRjBFRSIvPgo8c3RvcCBvZmZzZXQ9IjEiIHN0b3AtY29sb3I9IiNFQzg4N0QiLz4KPC9saW5lYXJHcmFkaWVudD4KPC9kZWZzPgo8L3N2Zz4K
keysOrder: [["apiVersion"], ["appVersion"], ["kind"], ["metadata"], ["metadata", "name"], ["spec", "locking"], ["spec", "storagePool"], ["spec", "ui"], ["spec", "users"]]
keysOrder: [["apiVersion"], ["appVersion"], ["kind"], ["metadata"], ["metadata", "name"], ["spec", "locking"], ["spec", "storagePool"], ["spec", "ui"], ["spec", "publicRead"], ["spec", "users"]]
secrets:
exclude: []
include:
@@ -39,4 +39,13 @@ driverName: {{ .Values.cosi.driverName }}
authenticationType: KEY
parameters:
accessPolicy: readonly
---
kind: BucketAccessClass
apiVersion: objectstorage.k8s.io/v1alpha1
metadata:
name: {{ .Values.cosi.bucketClassName }}-public
driverName: {{ .Values.cosi.driverName }}
authenticationType: KEY
parameters:
accessPolicy: public-read
{{- end }}
@@ -1,8 +1,8 @@
diff --git a/packages/system/seaweedfs/charts/seaweedfs/templates/cosi/cosi-bucket-class.yaml b/packages/system/seaweedfs/charts/seaweedfs/templates/cosi/cosi-bucket-class.yaml
index 4d19cc128..1ff0e7768 100644
index 4d19cc128..11d7fb779 100644
--- a/packages/system/seaweedfs/charts/seaweedfs/templates/cosi/cosi-bucket-class.yaml
+++ b/packages/system/seaweedfs/charts/seaweedfs/templates/cosi/cosi-bucket-class.yaml
@@ -11,10 +11,32 @@ parameters:
@@ -11,10 +11,41 @@
{{- toYaml . | nindent 2 }}
{{- end }}
---
@@ -34,4 +34,13 @@ index 4d19cc128..1ff0e7768 100644
+authenticationType: KEY
+parameters:
+ accessPolicy: readonly
+---
+kind: BucketAccessClass
+apiVersion: objectstorage.k8s.io/v1alpha1
+metadata:
+ name: {{ .Values.cosi.bucketClassName }}-public
+driverName: {{ .Values.cosi.driverName }}
+authenticationType: KEY
+parameters:
+ accessPolicy: public-read
{{- end }}
@@ -7,8 +7,8 @@ suite: seaweedfs COSI driver image pin
# BucketAccess and ignores the accessPolicy parameter. The chart ships a
# -readonly BucketAccessClass with parameters.accessPolicy: readonly, so on
# v0.1.2 a credential meant to be read-only is silently granted read-write.
# The package values.yaml overrides cosi.image to v0.4.0, which honours
# accessPolicy: readonly.
# The package values.yaml overrides cosi.image to v0.5.0, which honours
# accessPolicy: readonly and public-read.
#
# This test does not set the image itself; it relies on the package values.yaml
# override, so it goes red if that override is removed and the image falls back
@@ -25,7 +25,7 @@ release:
namespace: cozy-seaweedfs
tests:
- it: pins the cosi-driver container to v0.4.0 (read-only access enforcement)
- it: pins the cosi-driver container to v0.5.0 (read-only and public-read access policies)
template: charts/seaweedfs/templates/cosi/cosi-deployment.yaml
set:
seaweedfs.cosi.enabled: true
@@ -35,4 +35,4 @@ tests:
value: seaweedfs-cosi-driver
- equal:
path: spec.template.spec.containers[0].image
value: ghcr.io/seaweedfs/seaweedfs-cosi-driver:v0.4.0
value: ghcr.io/seaweedfs/seaweedfs-cosi-driver:v0.5.0
@@ -0,0 +1,25 @@
suite: vendored COSI classes include public-read
templates:
- charts/seaweedfs/templates/cosi/cosi-bucket-class.yaml
release:
name: seaweedfs-system
namespace: tenant-root
tests:
- it: renders a -public BucketAccessClass with the public-read policy
set:
seaweedfs:
cosi:
enabled: true
bucketClassName: tenant-root
driverName: tenant-root.seaweedfs.objectstorage.k8s.io
documentSelector:
path: metadata.name
value: tenant-root-public
asserts:
- isKind:
of: BucketAccessClass
- equal:
path: parameters.accessPolicy
value: public-read
+3 -2
View File
@@ -313,8 +313,9 @@ seaweedfs:
# actually issues read-only (Read,List) credentials instead of read-write.
# v0.4.0 also writes each grant to the per-identity IAM file: v0.3.1
# rewrites only the legacy identity.json, which the S3 gateways migrate
# concurrently, so a grant could be lost for good.
image: "ghcr.io/seaweedfs/seaweedfs-cosi-driver:v0.4.0"
# concurrently, so a grant could be lost for good. v0.5.0 adds the
# public-read accessPolicy the -public BucketAccessClass relies on.
image: "ghcr.io/seaweedfs/seaweedfs-cosi-driver:v0.5.0"
podLabels:
policy.cozystack.io/allow-to-apiserver: "true"
driverName: "seaweedfs.objectstorage.k8s.io"