fix(platform): stop handing tenants a root S3 the root tenant does not run (#5097)

## What this PR does

`cozystack-basics` writes `seaweedfs: tenant-root` into the
`cozystack-values` Secret of the root tenant unconditionally, so every
tenant without its own SeaweedFS inherits `tenant-root` as its S3, even
when `Tenant/root` has `spec.seaweedfs: false`. On a v1.6.5 cluster
whose root tenant runs no SeaweedFS, a tenant created a Bucket, its
BucketClaim asked for bucket class `tenant-root`, and the objectstorage
controller logged `bucketclasses.objectstorage.k8s.io "tenant-root" not
found` 8796 times over three days while the app stayed Ready. #5096
makes that state visible in WorkloadsReady, this PR removes its cause.

The new platform value `seaweedfs.rootEnabled` reaches cozystack-basics
as `_cluster.seaweedfs-enabled`, the same way `monitoring.rootEnabled`
reaches it as `_cluster.monitoring-enabled` for #3181, and
`_namespace.seaweedfs: tenant-root` is written only when it is true. The
default `true` keeps today's behaviour. The slim variants, which do not
install SeaweedFS for the root tenant, set it to `false` next to
`monitoring.rootEnabled`. Without S3 up the tenant chain the bucket and
harbor charts now fail to render with a message that names the problem,
instead of creating a claim for a class that never appears. A lookup of
the live Tenant is not used, for the reason
`monitoring-external-services.yaml` gives for the monitoring gate.

An existing Bucket or Harbor in a tenant without S3 up its chain fails
its next upgrade with that message once the flag is false. Its
BucketClaim was never provisioned, so nothing that worked stops working.

The platform tests cover propagation of seaweedfs.rootEnabled. Rendering
the root Secret with a missing flag keeps S3 enabled for older
installations. For a present key, only true or the string "true" enables
it. The bucket and harbor tests also cover the error when the tenant has
no S3. All 546 Helm tests across the four charts passed locally.

### Screenshots

Not a UI change.

### Downstream repositories

`packages/core/platform/values.yaml` gains `seaweedfs.rootEnabled`,
which the trigger map routes to `platform-package.md` on the website.
The variants page lists what the slim variants need for SeaweedFS, so it
gets the same note as monitoring. No app schema, values default or other
contract changes.

- [ ] No downstream repository is affected by this change
- [x] [cozystack/website](https://github.com/cozystack/website) -
follow-up: https://github.com/cozystack/website/pull/774
- [ ]
[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(platform): new platform value seaweedfs.rootEnabled. Set it to false when the root tenant runs no SeaweedFS, so tenants stop inheriting tenant-root as their S3 and a Bucket or Harbor without S3 up its tenant chain fails to render with a clear message instead of waiting on a bucket class that does not exist. The slim variants set it to false, so a slim cluster that runs SeaweedFS on Tenant/root must set seaweedfs.rootEnabled: true before the upgrade, or its Buckets and Harbors stop rendering.
```


<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
<!-- coderabbit-ai-generated:v1 -->

## Summary by CodeRabbit

* **New Features**
* Added a setting to control whether the root tenant provides SeaweedFS
for S3. It is enabled by default and disabled in slim ISP
configurations.
* Tenant configuration now includes SeaweedFS when root provision is
enabled or the setting is unspecified, and omits it when disabled.
* **Bug Fixes**
* Bucket and Harbor deployments now report a clear error when neither
the tenant nor an ancestor provides SeaweedFS, rather than rendering an
unusable S3 bucket claim.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
This commit is contained in:
Aleksei Sviridkin authored and GitHub committed 2026-12-02 15:46:00 +03:00
commit 06c2be9745
16 files changed
+188 -24

No files matched your search

+6 -6
View File
@@ -286,7 +286,7 @@ persistentvolumeclaim/db-qdrant-test-0'
tmp=$(mktemp -d)
write_fake_kubectl "$tmp"
render_hook "$HARBOR_CHART" harbor-test tenant-test harbor-test-cleanup "$tmp/hook.sh" \
--set '_namespace.host=example.org' --set '_cluster.solver=http01'
--set '_namespace.host=example.org' --set '_namespace.seaweedfs=tenant-root' --set '_cluster.solver=http01'
export KLOG="$tmp/calls"
export CHALLENGE_LIST='harbor-test-cert-1 '
@@ -322,7 +322,7 @@ persistentvolumeclaim/db-qdrant-test-0'
tmp=$(mktemp -d)
write_fake_kubectl "$tmp"
render_hook "$HARBOR_CHART" harbor-test tenant-test harbor-test-cleanup "$tmp/hook.sh" \
--set '_namespace.host=example.org' --set '_cluster.solver=http01'
--set '_namespace.host=example.org' --set '_namespace.seaweedfs=tenant-root' --set '_cluster.solver=http01'
export KLOG="$tmp/calls"
export CHALLENGE_LIST=''
@@ -350,7 +350,7 @@ persistentvolumeclaim/db-qdrant-test-0'
tmp=$(mktemp -d)
write_fake_kubectl "$tmp"
render_hook "$HARBOR_CHART" harbor-test tenant-test harbor-test-cleanup "$tmp/hook.sh" \
--set '_namespace.host=example.org' --set '_cluster.solver=http01'
--set '_namespace.host=example.org' --set '_namespace.seaweedfs=tenant-root' --set '_cluster.solver=http01'
export KLOG="$tmp/calls"
export CHALLENGE_LIST='harbor-test-cert-1 '
@@ -396,7 +396,7 @@ persistentvolumeclaim/db-qdrant-test-0'
tmp=$(mktemp -d)
write_fake_kubectl "$tmp"
render_hook "$HARBOR_CHART" harbor-test tenant-test harbor-test-cleanup "$tmp/hook.sh" \
--set '_namespace.host=example.org' --set '_cluster.solver=http01'
--set '_namespace.host=example.org' --set '_namespace.seaweedfs=tenant-root' --set '_cluster.solver=http01'
export KLOG="$tmp/calls"
export CHALLENGE_LIST='harbor-test-cert-1 '
@@ -438,7 +438,7 @@ persistentvolumeclaim/db-qdrant-test-0'
tmp=$(mktemp -d)
write_fake_kubectl "$tmp"
render_hook "$HARBOR_CHART" harbor-test tenant-test harbor-test-cleanup "$tmp/hook.sh" \
--set '_namespace.host=example.org' --set '_cluster.solver=http01'
--set '_namespace.host=example.org' --set '_namespace.seaweedfs=tenant-root' --set '_cluster.solver=http01'
export KLOG="$tmp/calls"
export CHALLENGE_LIST='harbor-test-cert-1 '
@@ -480,7 +480,7 @@ persistentvolumeclaim/db-qdrant-test-0'
tmp=$(mktemp -d)
write_fake_kubectl "$tmp"
render_hook "$HARBOR_CHART" harbor-test tenant-test harbor-test-cleanup "$tmp/hook.sh" \
--set '_namespace.host=example.org' --set '_cluster.solver=http01'
--set '_namespace.host=example.org' --set '_namespace.seaweedfs=tenant-root' --set '_cluster.solver=http01'
export KLOG="$tmp/calls"
export CHALLENGE_LIST=''
+2
View File
@@ -25,6 +25,8 @@ render_chart() {
tenant) set -- tenant-sub --api-versions v1.edp.epam.com/v1 ;;
# Satisfy the parent-cluster and release-name contract before the lookup.
kubernetes-nodes) set -- kubernetes-nodes-render-check --set-string cluster=render ;;
# Both refuse to render without S3 up the tenant chain.
bucket|harbor) set -- "$name-render-check" --set-string _namespace.seaweedfs=tenant-root ;;
*) set -- "$name-render-check" ;;
esac
helm template "$@" "$chart" -n tenant-test -f "$fixture"
+1
View File
@@ -57,6 +57,7 @@ render() {
bootbox) set -- bootbox; namespace=tenant-root ;;
computeplane|etcd|info|ingress|monitoring|seaweedfs|gateway) set -- "$name" ;;
external-dns) set -- external-dns --set provider=inmemory ;;
bucket|harbor) set -- "$name-render-check" --set-string _namespace.seaweedfs=tenant-root ;;
kubernetes-nodes) set -- kubernetes-nodes-render-check --set-string cluster=render \
--set-string resources.cpu=2 --set-string resources.memory=4Gi ;;
tenant) set -- tenant-sub --api-versions v1.edp.epam.com/v1 ;;
+1 -1
View File
@@ -14,7 +14,7 @@ The source of `_cluster` is `packages/core/platform/templates/apps.yaml`; `_name
| `configured.yaml` | OIDC on, per-host ACME via http01, shared services and topology constraint |
| `wildcard.yaml` | OIDC on, dns01 with a platform-issued wildcard certificate, shared services and topology constraint |
Each chart is attempted under every fixture. `vm-instance` and `kubernetes-nodes` require a `VirtualMachineClusterInstancetype` lookup on their defaults. The sweep accepts their skip only while every fixture fails with the recorded lookup diagnostic; a successful render or a different error fails the sweep. For kubernetes-nodes it supplies a parent cluster and matching release name first. For tenant it declares the Keycloak API with `--api-versions v1.edp.epam.com/v1`, allowing OIDC-enabled fixtures to render the realm groups.
Each chart is attempted under every fixture. `vm-instance` and `kubernetes-nodes` require a `VirtualMachineClusterInstancetype` lookup on their defaults. The sweep accepts their skip only while every fixture fails with the recorded lookup diagnostic; a successful render or a different error fails the sweep. For kubernetes-nodes it supplies a parent cluster and matching release name first. For bucket and harbor it names a SeaweedFS namespace, since both refuse to render without S3 up the tenant chain. For tenant it declares the Keycloak API with `--api-versions v1.edp.epam.com/v1`, allowing OIDC-enabled fixtures to render the realm groups.
`lookup` returns an empty result during this check. Tests for existing objects belong in chart-specific helm-unittest suites using `kubernetesProvider`; `packages/apps/clickhouse/tests/backup_api_password_persistence_test.yaml` covers both password generation and preservation that way. Presets, replica counts and other app feature toggles are outside this sweep.
@@ -1,4 +1,7 @@
{{- $seaweedfs := .Values._namespace.seaweedfs }}
{{- if not $seaweedfs }}
{{- fail "a bucket needs S3, and neither this tenant nor a tenant above it runs SeaweedFS" }}
{{- end }}
{{- $pool := .Values.storagePool }}
{{- /*
COSI classes are cluster-scoped and named after the namespace of the instance
@@ -0,0 +1,25 @@
suite: bucket needs an S3 backend in its tenant chain
templates:
- templates/bucketclaim.yaml
release:
name: my-bucket
namespace: tenant-demo
tests:
- it: claims the bucket class of the nearest tenant with SeaweedFS
set:
_namespace:
seaweedfs: tenant-root
asserts:
- equal:
path: spec.bucketClassName
value: tenant-root
- it: refuses to render when no tenant up the chain runs SeaweedFS
set:
_namespace:
seaweedfs: ""
asserts:
- failedTemplate:
errorPattern: "a bucket needs S3, and neither this tenant nor a tenant above it runs SeaweedFS"
@@ -1,4 +1,7 @@
{{- $seaweedfs := .Values._namespace.seaweedfs }}
{{- if not $seaweedfs }}
{{- fail "harbor keeps images in S3, and neither this tenant nor a tenant above it runs SeaweedFS" }}
{{- end }}
apiVersion: objectstorage.k8s.io/v1alpha1
kind: BucketClaim
metadata:
@@ -0,0 +1,28 @@
suite: harbor needs an S3 backend in its tenant chain
templates:
- templates/bucket.yaml
release:
name: harbor
namespace: tenant-demo
tests:
- it: claims the registry bucket from the nearest tenant with SeaweedFS
set:
_namespace:
seaweedfs: tenant-root
documentSelector:
path: kind
value: BucketClaim
asserts:
- equal:
path: spec.bucketClassName
value: tenant-root
- it: refuses to render when no tenant up the chain runs SeaweedFS
set:
_namespace:
seaweedfs: ""
asserts:
- failedTemplate:
errorPattern: "harbor keeps images in S3, and neither this tenant nor a tenant above it runs SeaweedFS"
@@ -290,6 +290,7 @@ stringData:
(Tenant/root spec.ingress). `dig`, as for monitoring-enabled
above, so an explicit false survives. */}}
ingress-enabled: {{ dig "rootEnabled" true (.Values.ingress | default dict) | quote }}
seaweedfs-enabled: {{ dig "rootEnabled" true (.Values.seaweedfs | default dict) | quote }}
{{- /* The rate each shared-central tracing tenant's collector holds it
to. Only written when set: every release in every tenant reads
this Secret, and a key appearing would upgrade all of them. */}}
@@ -0,0 +1,30 @@
suite: apps.yaml wires seaweedfs.rootEnabled into _cluster
templates:
- templates/apps.yaml
release:
name: cozy-platform
namespace: cozy-system
tests:
- it: writes seaweedfs-enabled true by default
asserts:
- matchRegex:
path: stringData["values.yaml"]
pattern: '(?m)^\s*seaweedfs-enabled:\s*"true"'
- it: writes seaweedfs-enabled false when seaweedfs.rootEnabled is disabled
set:
seaweedfs.rootEnabled: false
asserts:
- matchRegex:
path: stringData["values.yaml"]
pattern: '(?m)^\s*seaweedfs-enabled:\s*"false"'
- it: falls back to true (no panic) when seaweedfs is null
set:
seaweedfs: null
asserts:
- matchRegex:
path: stringData["values.yaml"]
pattern: '(?m)^\s*seaweedfs-enabled:\s*"true"'
@@ -26,3 +26,7 @@ bundles:
# into it would dead-end; see monitoring.rootEnabled in values.yaml.
monitoring:
rootEnabled: false
# Tenant/root does not run SeaweedFS here either, so tenants must not take it
# as their S3. See seaweedfs.rootEnabled in values.yaml.
seaweedfs:
rootEnabled: false
@@ -31,3 +31,7 @@ bundles:
# into it would dead-end; see monitoring.rootEnabled in values.yaml.
monitoring:
rootEnabled: false
# Tenant/root does not run SeaweedFS here either, so tenants must not take it
# as their S3. See seaweedfs.rootEnabled in values.yaml.
seaweedfs:
rootEnabled: false
@@ -31,3 +31,7 @@ bundles:
# into it would dead-end; see monitoring.rootEnabled in values.yaml.
monitoring:
rootEnabled: false
# Tenant/root does not run SeaweedFS here either, so tenants must not take it
# as their S3. See seaweedfs.rootEnabled in values.yaml.
seaweedfs:
rootEnabled: false
+7
View File
@@ -835,6 +835,13 @@ ingress:
# to keep the value existing clusters already render.
rootEnabled: true
# Platform object storage configuration.
seaweedfs:
# Whether the root tenant (tenant-root) runs SeaweedFS, i.e. Tenant/root
# spec.seaweedfs=true. Tenants without their own SeaweedFS take tenant-root
# as their S3 only when this is true. Keep it in sync with Tenant/root
# spec.seaweedfs, the default true preserves the historical behaviour.
rootEnabled: true
# Platform monitoring configuration.
monitoring:
# Whether the root tenant (tenant-root) hosts the platform
@@ -23,8 +23,8 @@ stringData:
{{- if or (kindIs "invalid" $ingress) (eq (toString $ingress) "true") }}
ingress: tenant-root
{{- end }}
{{- /* `gateway` is conditional, the other four `_namespace` keys are
unconditional. The `apps/tenant` chart gates tenant-root via
{{- /* `gateway`, `ingress` and `seaweedfs` are conditional, `etcd` and
`monitoring` are unconditional. The `apps/tenant` chart gates tenant-root via
`ne (include "tenant.name" .) "tenant-root"`, so the namespace.yaml
propagation fix that consumes `tenant.gatewayEffective` never
reaches tenant-root — and the `cozystack-values` Secret rendered
@@ -42,4 +42,7 @@ stringData:
gateway: tenant-root
{{- end }}
monitoring: tenant-root
{{- $seaweedfs := dig "seaweedfs-enabled" true (.Values._cluster | default dict) }}
{{- if eq (toString $seaweedfs) "true" }}
seaweedfs: tenant-root
{{- end }}
@@ -19,16 +19,17 @@ set:
# never reaches tenant-root — this Secret is the only place that
# value gets set for the root tenant.
#
# Three of the five `_namespace.*` keys (`etcd`, `monitoring`,
# `seaweedfs`) are always rendered, because their dependent platform
# apps are always installable in tenant-root. `gateway` is conditional
# on `_cluster.gateway-enabled`: when the platform-level flag is false
# (the default), Gateway is not installed, and writing
# `gateway: tenant-root` would point apps at a Gateway that doesn't
# exist. `ingress` is conditional on `_cluster.ingress-enabled` for the
# same reason: with ingress off on the root Tenant there is no
# ingress-nginx-system in tenant-root, and seaweedfs would wait on it
# forever. The fixtures below pin both halves of each contract.
# Two of the five `_namespace.*` keys (`etcd`, `monitoring`) are always
# rendered, because their dependent platform apps are always installable
# in tenant-root. `gateway` is conditional on `_cluster.gateway-enabled`:
# when the platform-level flag is false (the default), Gateway is not
# installed, and writing `gateway: tenant-root` would point apps at a
# Gateway that doesn't exist. `ingress` is conditional on
# `_cluster.ingress-enabled` for the same reason: with ingress off on the
# root Tenant there is no ingress-nginx-system in tenant-root, and
# seaweedfs would wait on it forever. `seaweedfs` follows
# `_cluster.seaweedfs-enabled`, so tenants do not inherit an S3 the root
# tenant does not run. The fixtures below pin both halves of each contract.
tests:
- it: omits _namespace.gateway when _cluster.gateway-enabled is missing (default)
asserts:
@@ -102,7 +103,7 @@ tests:
path: stringData["values.yaml"]
pattern: '(?m)^\s+seaweedfs: tenant-root$'
- it: keeps _namespace.{etcd,ingress,monitoring,seaweedfs} unconditional when Gateway is off — regression guard for a refactor that accidentally gates them on the same flag
- it: keeps _namespace.{etcd,ingress,monitoring} when Gateway is off — regression guard for a refactor that accidentally gates them on the same flag
asserts:
- matchRegex:
path: stringData["values.yaml"]
@@ -113,11 +114,8 @@ tests:
- matchRegex:
path: stringData["values.yaml"]
pattern: '(?m)^\s+monitoring: tenant-root$'
- matchRegex:
path: stringData["values.yaml"]
pattern: '(?m)^\s+seaweedfs: tenant-root$'
- it: keeps _namespace.{etcd,ingress,monitoring,seaweedfs} unconditional when Gateway is on — same guard, opposite mode
- it: keeps _namespace.{etcd,ingress,monitoring} when Gateway is on — same guard, opposite mode
set:
_cluster:
gateway-enabled: "true"
@@ -131,6 +129,9 @@ tests:
- matchRegex:
path: stringData["values.yaml"]
pattern: '(?m)^\s+monitoring: tenant-root$'
- it: emits _namespace.seaweedfs=tenant-root when _cluster.seaweedfs-enabled is missing
asserts:
- matchRegex:
path: stringData["values.yaml"]
pattern: '(?m)^\s+seaweedfs: tenant-root$'
@@ -143,3 +144,51 @@ tests:
- notMatchRegex:
path: stringData["values.yaml"]
pattern: '(?m)^\s+ingress:'
- it: emits _namespace.seaweedfs=tenant-root when _cluster.seaweedfs-enabled is "true"
set:
_cluster:
seaweedfs-enabled: "true"
asserts:
- matchRegex:
path: stringData["values.yaml"]
pattern: '(?m)^\s+seaweedfs: tenant-root$'
- it: omits _namespace.seaweedfs when _cluster.seaweedfs-enabled is "false"
set:
_cluster:
seaweedfs-enabled: "false"
asserts:
- notMatchRegex:
path: stringData["values.yaml"]
pattern: '(?m)^\s+seaweedfs:'
- matchRegex:
path: stringData["values.yaml"]
pattern: '(?m)^\s+monitoring: tenant-root$'
- it: omits _namespace.seaweedfs when _cluster.seaweedfs-enabled is a bool false
set:
_cluster:
seaweedfs-enabled: false
asserts:
- notMatchRegex:
path: stringData["values.yaml"]
pattern: '(?m)^\s+seaweedfs:'
- it: omits _namespace.seaweedfs when _cluster.seaweedfs-enabled is null
set:
_cluster:
seaweedfs-enabled: null
asserts:
- notMatchRegex:
path: stringData["values.yaml"]
pattern: '(?m)^\s+seaweedfs:'
- it: omits _namespace.seaweedfs when _cluster.seaweedfs-enabled is neither missing nor true
set:
_cluster:
seaweedfs-enabled: "no"
asserts:
- notMatchRegex:
path: stringData["values.yaml"]
pattern: '(?m)^\s+seaweedfs:'