mirror of
https://github.com/cozystack/cozystack.git
synced 2026-12-03 21:53:20 +09:00
fix(seaweedfs): stop reserving storage pool name suffixes (#5426)
## What this PR does The SeaweedFS chart refused any storage pool named `public` or ending in `-lock`, `-readonly` or `-public`. A second check in the same template compares the class names each pool actually renders, against each other and against the instance's base classes, and it already refuses every one of those names that clashes with something. `public`, `lock` and `readonly` clash with the base classes. `x-public`, `x-lock` and `x-readonly` clash only when a pool `x` exists. The suffix list therefore refused only names that clash with nothing, such as `cdn-public` with no pool `cdn`, and it would have needed another breaking change for every new class variant. I removed the suffix list and kept the rendered-name check as the only rule. Every values set that rendered before renders the same objects now. Names that were refused without a real clash are now accepted. Nothing that was accepted is refused, so this is not a breaking change. The tests now cover both sides of the rule. `cdn-public`, `cdn-lock` and `cdn-readonly` without a `cdn` pool are accepted, in `volume.pools` and in a zone. A pool next to its own `-public`, `-readonly` or `-lock` variant is refused with the clash message, and so is a pool named `public`. Related: #5316 is already handled on main by the rendered-name check (pools named exactly `lock` or `readonly` are refused there). #5412 takes the opposite approach and extends the reserved-name list in the same files. ### Screenshots Not a UI change. ### Downstream repositories - [ ] No downstream repository is affected by this change - [ ] [cozystack/website](https://github.com/cozystack/website) - follow-up: the storage pools page says pool names ending in `-lock` or `-readonly` are reserved; it should say a pool name must not render a class name another pool or the base classes already use. - [ ] [cozystack/terraform-provider-cozystack](https://github.com/cozystack/terraform-provider-cozystack) - follow-up: - [ ] [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: ### Release note ```release-note fix(seaweedfs): storage pool names are no longer refused for a reserved suffix; a pool is refused only when one of its BucketClass or BucketAccessClass names is already rendered by another pool or by the instance's base classes. ``` <!-- This is an auto-generated comment: release notes by coderabbit.ai --> <!-- coderabbit-ai-generated:v1 --> ## Summary by CodeRabbit * **Bug Fixes** * Pool names ending in `-public`, `-lock`, or `-readonly` are now accepted when their rendered class names don’t conflict with another pool or a base class. * Name collisions are still rejected with errors that identify the conflicting rendered class. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
This commit is contained in:
2 files changed
+82
-52
No files matched your search
@@ -32,9 +32,6 @@
|
||||
{{- 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) (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) }}
|
||||
{{- end }}
|
||||
@@ -52,9 +49,6 @@
|
||||
{{- 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) (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) }}
|
||||
{{- end }}
|
||||
@@ -76,10 +70,11 @@
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
|
||||
{{- /* -lock-noretention is not a reserved suffix: releases with pools named
|
||||
that way predate the class, and refusing the name would block their
|
||||
upgrade. Only an actual clash between rendered class names fails,
|
||||
across both pool paths and against the base classes. */ -}}
|
||||
{{- /* No pool name or suffix is reserved: a reserved suffix would refuse
|
||||
names that collide with nothing and block the upgrade of releases
|
||||
already using them each time a class variant is added. Only an
|
||||
actual clash between rendered class names fails, across both pool
|
||||
paths and against the base classes. */ -}}
|
||||
{{- if gt (len $allPools) 0 }}
|
||||
{{- $classOwners := dict }}
|
||||
{{- range $suffix := list "" "-lock" "-lock-noretention" }}
|
||||
|
||||
@@ -49,10 +49,55 @@ tests:
|
||||
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
|
||||
# Only an actual clash between rendered class names is refused, so a pool
|
||||
# suffix is free to use unless another pool owns the base name.
|
||||
- it: accepts a pool name ending in -public when no pool owns the base name
|
||||
template: templates/storage-pool-bucket-classes.yaml
|
||||
set:
|
||||
topology: Simple
|
||||
volume:
|
||||
pools:
|
||||
cdn-public:
|
||||
diskType: ssd
|
||||
documentSelector:
|
||||
path: metadata.name
|
||||
value: tenant-root-cdn-public-public
|
||||
asserts:
|
||||
- isKind:
|
||||
of: BucketAccessClass
|
||||
- equal:
|
||||
path: parameters.accessPolicy
|
||||
value: public-read
|
||||
|
||||
- it: accepts -public, -lock and -readonly pool names without their base pool
|
||||
template: templates/seaweedfs.yaml
|
||||
set:
|
||||
volume:
|
||||
pools:
|
||||
cdn-public:
|
||||
diskType: ssd
|
||||
cdn-lock:
|
||||
diskType: hdd
|
||||
cdn-readonly:
|
||||
diskType: nvme
|
||||
asserts:
|
||||
- notFailedTemplate: {}
|
||||
|
||||
- it: accepts a zone pool name ending in -public
|
||||
template: templates/seaweedfs.yaml
|
||||
set:
|
||||
topology: MultiZone
|
||||
replicationFactor: 1
|
||||
volume:
|
||||
zones:
|
||||
a:
|
||||
pools:
|
||||
cdn-public:
|
||||
diskType: ssd
|
||||
asserts:
|
||||
- notFailedTemplate: {}
|
||||
|
||||
- it: refuses a pool whose base class is another pool's -public class
|
||||
template: templates/seaweedfs.yaml
|
||||
set:
|
||||
volume:
|
||||
@@ -63,7 +108,33 @@ tests:
|
||||
diskType: nvme
|
||||
asserts:
|
||||
- failedTemplate:
|
||||
errorPattern: volume.pools key 'fast-public' must not be 'public' or end with
|
||||
errorMessage: "storage pool 'fast-public' renders BucketAccessClass tenant-root-fast-public, also rendered by storage pool 'fast'; rename the pool."
|
||||
|
||||
- it: refuses a pool whose base class is another pool's -readonly class
|
||||
template: templates/seaweedfs.yaml
|
||||
set:
|
||||
volume:
|
||||
pools:
|
||||
fast:
|
||||
diskType: ssd
|
||||
fast-readonly:
|
||||
diskType: nvme
|
||||
asserts:
|
||||
- failedTemplate:
|
||||
errorMessage: "storage pool 'fast-readonly' renders BucketAccessClass tenant-root-fast-readonly, also rendered by storage pool 'fast'; rename the pool."
|
||||
|
||||
- it: refuses a pool whose base class is another pool's -lock class
|
||||
template: templates/seaweedfs.yaml
|
||||
set:
|
||||
volume:
|
||||
pools:
|
||||
fast:
|
||||
diskType: ssd
|
||||
fast-lock:
|
||||
diskType: nvme
|
||||
asserts:
|
||||
- failedTemplate:
|
||||
errorMessage: "storage pool 'fast-lock' renders BucketClass tenant-root-fast-lock, also rendered by storage pool 'fast'; rename the pool."
|
||||
|
||||
- it: refuses a pool named public
|
||||
template: templates/seaweedfs.yaml
|
||||
@@ -74,40 +145,4 @@ tests:
|
||||
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: {}
|
||||
errorMessage: "storage pool 'public' renders BucketAccessClass tenant-root-public, also rendered by the base classes; rename the pool."
|
||||
Reference in new issue
Block a user