fix(seaweedfs): run the worker that enforces bucket lifecycle rules

SeaweedFS accepts and stores a bucket lifecycle configuration, but only
the s3_lifecycle job of its plugin worker acts on it, and that job is
scheduled by the admin server. Neither ran here, so a rule returned 200
and no object ever expired, on the platform backup bucket and on tenant
buckets alike, and the documented way to bound backup storage did
nothing.

Both now run in Simple and MultiZone instances, behind lifecycle.enabled
(on by default). A Client instance has no data plane of its own; its
rules are enforced where the master it connects to runs. The worker
registers for s3_lifecycle alone, so enabling lifecycle does not also
start vacuum, balancing or erasure coding. The admin keeps its job state
on a small volume (on volume.storageClass when set), and its UI gets a
generated password, because a tenant namespace admits traffic from the
whole cluster and the server is unauthenticated without one. The
data-plane chart keeps both off unless its parent turns them on, so it
never starts an admin without that password.

Existing rules start applying minutes after the upgrade: the admin's
scheduler runs the first pass within one idle cycle of its lifecycle
lane, then once a day, and objects the rules have already expired are
deleted on that first pass.

Assisted-by: LLM
Signed-off-by: Alexey Artamonov <aleksei.artamonov@aenix.io>
This commit is contained in:
Alexey Artamonov committed 2026-11-04 19:30:47 +03:00
1 parent 2cc90b18f5
commit f36d864e99
9 files changed
+447 -2

No files matched your search

+2
View File
@@ -78,4 +78,6 @@
| `s3.resources.cpu` | Number of CPU cores allocated. | `quantity` | `""` |
| `s3.resources.memory` | Amount of memory allocated. | `quantity` | `""` |
| `s3.resourcesPreset` | Default sizing preset used when `resources` is omitted. | `string` | `t1.small` |
| `lifecycle` | S3 bucket lifecycle configuration. | `object` | `{}` |
| `lifecycle.enabled` | Run the SeaweedFS admin server and a worker that applies bucket lifecycle rules, once a day. When disabled, rules are still accepted and stored, but not applied. Ignored with the Client topology, whose rules are enforced by the instance it connects to. | `bool` | `true` |
@@ -0,0 +1,21 @@
{{- if and .Values.lifecycle.enabled (ne .Values.topology "Client") }}
{{- $name := printf "%s-admin-credentials" .Release.Name }}
{{- /* The admin reads these into its environment when it starts and nothing
restarts it on a Secret change, so a password regenerated on every render
would leave the Secret holding one the running server does not accept.
Keep the one already issued. */}}
{{- $password := randAlphaNum 40 | b64enc }}
{{- with lookup "v1" "Secret" .Release.Namespace $name }}
{{- with (dig "data" "adminPassword" "" .) }}
{{- $password = . }}
{{- end }}
{{- end }}
apiVersion: v1
kind: Secret
metadata:
name: {{ $name }}
type: Opaque
data:
adminUser: {{ "admin" | b64enc }}
adminPassword: {{ $password }}
{{- end }}
@@ -370,6 +370,16 @@ spec:
secretName: {{ .Release.Name }}-s3-ingress-tls
{{- end }}
resources: {{- include "cozy-lib.resources.defaultingSanitize" (list .Values.s3.resourcesPreset .Values.s3.resources $) | nindent 10 }}
admin:
enabled: {{ .Values.lifecycle.enabled }}
secret:
existingSecret: {{ .Release.Name }}-admin-credentials
{{- with .Values.volume.storageClass }}
data:
storageClass: {{ . }}
{{- end }}
worker:
enabled: {{ .Values.lifecycle.enabled }}
cosi:
driverName: "{{ .Release.Namespace }}.seaweedfs.objectstorage.k8s.io"
bucketClassName: "{{ .Release.Namespace }}"
@@ -502,4 +512,22 @@ spec:
app.kubernetes.io/component: s3
app.kubernetes.io/name: seaweedfs
version: {{ $.Chart.Version }}
{{- if .Values.lifecycle.enabled }}
{{- range $component := list "admin" "worker" }}
---
apiVersion: cozystack.io/v1alpha1
kind: WorkloadMonitor
metadata:
name: {{ $.Release.Name }}-{{ $component }}
spec:
replicas: 1
minReplicas: 1
kind: seaweedfs
type: {{ $component }}
selector:
app.kubernetes.io/component: {{ $component }}
app.kubernetes.io/name: seaweedfs
version: {{ $.Chart.Version }}
{{- end }}
{{- end }}
{{- end }}
@@ -0,0 +1,196 @@
suite: seaweedfs lifecycle switch reaches the data plane
# lifecycle.enabled decides whether the data-plane release runs the admin
# server and the worker that enforce bucket lifecycle rules. Both flags are
# sent either way, so the data-plane chart's own default never decides.
templates:
- templates/seaweedfs.yaml
- templates/admin-credentials.yaml
release:
name: seaweedfs
namespace: tenant-root
tests:
- it: runs the lifecycle admin and worker by default
template: templates/seaweedfs.yaml
set: &platform
_namespace:
host: example.org
ingress: tenant-root
_cluster:
issuer-name: letsencrypt-prod
solver: http01
documentSelector:
path: metadata.name
value: seaweedfs-system
asserts:
- equal:
path: spec.values.seaweedfs.admin.enabled
value: true
- equal:
path: spec.values.seaweedfs.worker.enabled
value: true
- equal:
path: spec.values.seaweedfs.admin.secret.existingSecret
value: seaweedfs-admin-credentials
- it: turns both off when lifecycle is disabled
template: templates/seaweedfs.yaml
set:
<<: *platform
lifecycle:
enabled: false
documentSelector:
path: metadata.name
value: seaweedfs-system
asserts:
- equal:
path: spec.values.seaweedfs.admin.enabled
value: false
- equal:
path: spec.values.seaweedfs.worker.enabled
value: false
# The admin's volume follows volume.storageClass when the instance sets one.
# Zone storage classes are not followed: the admin is not pinned to a zone.
- it: puts the admin volume on the instance's storage class
template: templates/seaweedfs.yaml
set:
<<: *platform
volume:
storageClass: replicated
documentSelector:
path: metadata.name
value: seaweedfs-system
asserts:
- equal:
path: spec.values.seaweedfs.admin.data.storageClass
value: replicated
- it: leaves the admin volume on the cluster default when the instance names none
template: templates/seaweedfs.yaml
set: *platform
documentSelector:
path: metadata.name
value: seaweedfs-system
asserts:
- notExists:
path: spec.values.seaweedfs.admin.data
- it: monitors the admin and the worker while lifecycle is on
template: templates/seaweedfs.yaml
set: *platform
asserts:
- containsDocument:
kind: WorkloadMonitor
apiVersion: cozystack.io/v1alpha1
name: seaweedfs-admin
any: true
- containsDocument:
kind: WorkloadMonitor
apiVersion: cozystack.io/v1alpha1
name: seaweedfs-worker
any: true
- equal:
path: spec.selector
value:
app.kubernetes.io/component: worker
app.kubernetes.io/name: seaweedfs
documentSelector:
path: metadata.name
value: seaweedfs-worker
- equal:
path: spec.selector
value:
app.kubernetes.io/component: admin
app.kubernetes.io/name: seaweedfs
documentSelector:
path: metadata.name
value: seaweedfs-admin
- it: does not monitor them when lifecycle is off
template: templates/seaweedfs.yaml
set:
<<: *platform
lifecycle:
enabled: false
asserts:
- containsDocument:
kind: WorkloadMonitor
apiVersion: cozystack.io/v1alpha1
name: seaweedfs-admin
any: true
not: true
- containsDocument:
kind: WorkloadMonitor
apiVersion: cozystack.io/v1alpha1
name: seaweedfs-worker
any: true
not: true
- it: generates admin credentials for a new instance
template: templates/admin-credentials.yaml
set: *platform
asserts:
- isKind:
of: Secret
- equal:
path: metadata.name
value: seaweedfs-admin-credentials
- equal:
path: data.adminUser
value: YWRtaW4=
- matchRegex:
path: data.adminPassword
pattern: '^.{40,}$'
# A new password on every render would leave the running admin on the old
# one, since it reads the Secret into its environment once at start.
- it: keeps the password of an existing Secret
template: templates/admin-credentials.yaml
set: *platform
kubernetesProvider:
scheme:
"v1/Secret":
gvr:
version: v1
resource: secrets
namespaced: true
objects:
- apiVersion: v1
kind: Secret
metadata:
name: seaweedfs-admin-credentials
namespace: tenant-root
data:
adminUser: YWRtaW4=
adminPassword: a2VwdA==
asserts:
- equal:
path: data.adminPassword
value: a2VwdA==
- it: renders no credentials when lifecycle is off
template: templates/admin-credentials.yaml
set:
<<: *platform
lifecycle:
enabled: false
asserts:
- hasDocuments:
count: 0
# A Client instance runs no data plane of its own; its rules are enforced
# where the master it points at runs.
- it: renders no credentials for a Client instance
template: templates/admin-credentials.yaml
set:
<<: *platform
topology: Client
filer:
grpcHost: seaweedfs-filer.tenant-other.svc
asserts:
- hasDocuments:
count: 0
@@ -868,6 +868,18 @@
]
}
}
},
"lifecycle": {
"description": "S3 bucket lifecycle configuration.",
"type": "object",
"default": {},
"properties": {
"enabled": {
"description": "Run the SeaweedFS admin server and a worker that applies bucket lifecycle rules, once a day. When disabled, rules are still accepted and stored, but not applied. Ignored with the Client topology, whose rules are enforced by the instance it connects to.",
"type": "boolean",
"default": true
}
}
}
}
}
+7
View File
@@ -192,3 +192,10 @@ s3:
replicas: 2
resources: {}
resourcesPreset: "t1.small"
## @typedef {struct} Lifecycle - Enforcement of S3 bucket lifecycle rules.
## @field {bool} [enabled] - Run the SeaweedFS admin server and a worker that applies bucket lifecycle rules, once a day. When disabled, rules are still accepted and stored, but not applied. Ignored with the Client topology, whose rules are enforced by the instance it connects to.
## @param {Lifecycle} [lifecycle] - S3 bucket lifecycle configuration.
lifecycle:
enabled: true
+2 -2
View File
@@ -8,7 +8,7 @@ spec:
singular: seaweedfs
plural: seaweedfses
openAPISchema: |-
{"title":"Chart Values","type":"object","properties":{"host":{"description":"The hostname used to access SeaweedFS externally (defaults to 's3' subdomain for the tenant host).","type":"string","default":""},"topology":{"description":"The topology of the SeaweedFS cluster.","type":"string","default":"Simple","enum":["Simple","MultiZone","Client"]},"replicationFactor":{"description":"Replication factor: number of replicas for each volume in the SeaweedFS cluster.","type":"integer","default":2},"db":{"description":"Database configuration.","type":"object","default":{},"properties":{"replicas":{"description":"Number of database replicas.","type":"integer","default":2},"resources":{"description":"Explicit CPU and memory configuration. When omitted, the preset defined in `resourcesPreset` is applied.","type":"object","default":{},"properties":{"cpu":{"description":"Number of CPU cores allocated.","pattern":"^(\\+|-)?(([0-9]+(\\.[0-9]*)?)|(\\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\\+|-)?(([0-9]+(\\.[0-9]*)?)|(\\.[0-9]+))))?$","anyOf":[{"type":"integer"},{"type":"string"}],"x-kubernetes-int-or-string":true},"memory":{"description":"Amount of memory allocated.","pattern":"^(\\+|-)?(([0-9]+(\\.[0-9]*)?)|(\\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\\+|-)?(([0-9]+(\\.[0-9]*)?)|(\\.[0-9]+))))?$","anyOf":[{"type":"integer"},{"type":"string"}],"x-kubernetes-int-or-string":true}}},"resourcesPreset":{"description":"Default sizing preset used when `resources` is omitted.","type":"string","default":"t1.small","enum":["t1.nano","t1.micro","t1.small","t1.medium","t1.large","t1.xlarge","t1.2xlarge","t1.4xlarge","c1.nano","c1.micro","c1.small","c1.medium","c1.large","c1.xlarge","c1.2xlarge","c1.4xlarge","s1.nano","s1.micro","s1.small","s1.medium","s1.large","s1.xlarge","s1.2xlarge","s1.4xlarge","u1.nano","u1.micro","u1.small","u1.medium","u1.large","u1.xlarge","u1.2xlarge","u1.4xlarge","m1.nano","m1.micro","m1.small","m1.medium","m1.large","m1.xlarge","m1.2xlarge","m1.4xlarge","nano","micro","small","medium","large","xlarge","2xlarge"]},"size":{"description":"Persistent Volume size.","default":"10Gi","pattern":"^(\\+|-)?(([0-9]+(\\.[0-9]*)?)|(\\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\\+|-)?(([0-9]+(\\.[0-9]*)?)|(\\.[0-9]+))))?$","anyOf":[{"type":"integer"},{"type":"string"}],"x-kubernetes-int-or-string":true},"storageClass":{"description":"StorageClass used to store the data.","type":"string","default":""}}},"master":{"description":"Master service configuration.","type":"object","default":{},"properties":{"replicas":{"description":"Number of master replicas.","type":"integer","default":3},"resources":{"description":"Explicit CPU and memory configuration. When omitted, the preset defined in `resourcesPreset` is applied.","type":"object","default":{},"properties":{"cpu":{"description":"Number of CPU cores allocated.","pattern":"^(\\+|-)?(([0-9]+(\\.[0-9]*)?)|(\\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\\+|-)?(([0-9]+(\\.[0-9]*)?)|(\\.[0-9]+))))?$","anyOf":[{"type":"integer"},{"type":"string"}],"x-kubernetes-int-or-string":true},"memory":{"description":"Amount of memory allocated.","pattern":"^(\\+|-)?(([0-9]+(\\.[0-9]*)?)|(\\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\\+|-)?(([0-9]+(\\.[0-9]*)?)|(\\.[0-9]+))))?$","anyOf":[{"type":"integer"},{"type":"string"}],"x-kubernetes-int-or-string":true}}},"resourcesPreset":{"description":"Default sizing preset used when `resources` is omitted.","type":"string","default":"t1.small","enum":["t1.nano","t1.micro","t1.small","t1.medium","t1.large","t1.xlarge","t1.2xlarge","t1.4xlarge","c1.nano","c1.micro","c1.small","c1.medium","c1.large","c1.xlarge","c1.2xlarge","c1.4xlarge","s1.nano","s1.micro","s1.small","s1.medium","s1.large","s1.xlarge","s1.2xlarge","s1.4xlarge","u1.nano","u1.micro","u1.small","u1.medium","u1.large","u1.xlarge","u1.2xlarge","u1.4xlarge","m1.nano","m1.micro","m1.small","m1.medium","m1.large","m1.xlarge","m1.2xlarge","m1.4xlarge","nano","micro","small","medium","large","xlarge","2xlarge"]},"volumeSizeLimitMB":{"description":"Size in MB at which a volume stops taking writes, and the divisor that sets how many buckets a volume server can serve. Lower it to fit more buckets on the same disk, at the cost of more volume files for the same stored data; on a large volume it is worth raising instead. Changing it on an instance that already holds data costs something either way: lowering it stops writes to every bucket whose volumes all reach the new value until that bucket can grow, and raising it takes the room new buckets grow into, so run the check in docs/operations/seaweedfs-lowering-the-volume-size-limit.md first. Must be between 1 and 30000. A value close to or above `volume.size` leaves each volume server a single slot rather than failing, since the server floors its slot count at one.","type":"integer","default":400,"maximum":30000,"minimum":1}}},"filer":{"description":"Filer service configuration.","type":"object","default":{},"properties":{"grpcHost":{"description":"TheLine truncated
{"title":"Chart Values","type":"object","properties":{"host":{"description":"The hostname used to access SeaweedFS externally (defaults to 's3' subdomain for the tenant host).","type":"string","default":""},"topology":{"description":"The topology of the SeaweedFS cluster.","type":"string","default":"Simple","enum":["Simple","MultiZone","Client"]},"replicationFactor":{"description":"Replication factor: number of replicas for each volume in the SeaweedFS cluster.","type":"integer","default":2},"db":{"description":"Database configuration.","type":"object","default":{},"properties":{"replicas":{"description":"Number of database replicas.","type":"integer","default":2},"resources":{"description":"Explicit CPU and memory configuration. When omitted, the preset defined in `resourcesPreset` is applied.","type":"object","default":{},"properties":{"cpu":{"description":"Number of CPU cores allocated.","pattern":"^(\\+|-)?(([0-9]+(\\.[0-9]*)?)|(\\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\\+|-)?(([0-9]+(\\.[0-9]*)?)|(\\.[0-9]+))))?$","anyOf":[{"type":"integer"},{"type":"string"}],"x-kubernetes-int-or-string":true},"memory":{"description":"Amount of memory allocated.","pattern":"^(\\+|-)?(([0-9]+(\\.[0-9]*)?)|(\\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\\+|-)?(([0-9]+(\\.[0-9]*)?)|(\\.[0-9]+))))?$","anyOf":[{"type":"integer"},{"type":"string"}],"x-kubernetes-int-or-string":true}}},"resourcesPreset":{"description":"Default sizing preset used when `resources` is omitted.","type":"string","default":"t1.small","enum":["t1.nano","t1.micro","t1.small","t1.medium","t1.large","t1.xlarge","t1.2xlarge","t1.4xlarge","c1.nano","c1.micro","c1.small","c1.medium","c1.large","c1.xlarge","c1.2xlarge","c1.4xlarge","s1.nano","s1.micro","s1.small","s1.medium","s1.large","s1.xlarge","s1.2xlarge","s1.4xlarge","u1.nano","u1.micro","u1.small","u1.medium","u1.large","u1.xlarge","u1.2xlarge","u1.4xlarge","m1.nano","m1.micro","m1.small","m1.medium","m1.large","m1.xlarge","m1.2xlarge","m1.4xlarge","nano","micro","small","medium","large","xlarge","2xlarge"]},"size":{"description":"Persistent Volume size.","default":"10Gi","pattern":"^(\\+|-)?(([0-9]+(\\.[0-9]*)?)|(\\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\\+|-)?(([0-9]+(\\.[0-9]*)?)|(\\.[0-9]+))))?$","anyOf":[{"type":"integer"},{"type":"string"}],"x-kubernetes-int-or-string":true},"storageClass":{"description":"StorageClass used to store the data.","type":"string","default":""}}},"master":{"description":"Master service configuration.","type":"object","default":{},"properties":{"replicas":{"description":"Number of master replicas.","type":"integer","default":3},"resources":{"description":"Explicit CPU and memory configuration. When omitted, the preset defined in `resourcesPreset` is applied.","type":"object","default":{},"properties":{"cpu":{"description":"Number of CPU cores allocated.","pattern":"^(\\+|-)?(([0-9]+(\\.[0-9]*)?)|(\\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\\+|-)?(([0-9]+(\\.[0-9]*)?)|(\\.[0-9]+))))?$","anyOf":[{"type":"integer"},{"type":"string"}],"x-kubernetes-int-or-string":true},"memory":{"description":"Amount of memory allocated.","pattern":"^(\\+|-)?(([0-9]+(\\.[0-9]*)?)|(\\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\\+|-)?(([0-9]+(\\.[0-9]*)?)|(\\.[0-9]+))))?$","anyOf":[{"type":"integer"},{"type":"string"}],"x-kubernetes-int-or-string":true}}},"resourcesPreset":{"description":"Default sizing preset used when `resources` is omitted.","type":"string","default":"t1.small","enum":["t1.nano","t1.micro","t1.small","t1.medium","t1.large","t1.xlarge","t1.2xlarge","t1.4xlarge","c1.nano","c1.micro","c1.small","c1.medium","c1.large","c1.xlarge","c1.2xlarge","c1.4xlarge","s1.nano","s1.micro","s1.small","s1.medium","s1.large","s1.xlarge","s1.2xlarge","s1.4xlarge","u1.nano","u1.micro","u1.small","u1.medium","u1.large","u1.xlarge","u1.2xlarge","u1.4xlarge","m1.nano","m1.micro","m1.small","m1.medium","m1.large","m1.xlarge","m1.2xlarge","m1.4xlarge","nano","micro","small","medium","large","xlarge","2xlarge"]},"volumeSizeLimitMB":{"description":"Size in MB at which a volume stops taking writes, and the divisor that sets how many buckets a volume server can serve. Lower it to fit more buckets on the same disk, at the cost of more volume files for the same stored data; on a large volume it is worth raising instead. Changing it on an instance that already holds data costs something either way: lowering it stops writes to every bucket whose volumes all reach the new value until that bucket can grow, and raising it takes the room new buckets grow into, so run the check in docs/operations/seaweedfs-lowering-the-volume-size-limit.md first. Must be between 1 and 30000. A value close to or above `volume.size` leaves each volume server a single slot rather than failing, since the server floors its slot count at one.","type":"integer","default":400,"maximum":30000,"minimum":1}}},"filer":{"description":"Filer service configuration.","type":"object","default":{},"properties":{"grpcHost":{"description":"TheLine truncated
release:
prefix: ""
labels:
@@ -26,7 +26,7 @@ spec:
description: Seaweedfs
module: true
icon: PHN2ZyB3aWR0aD0iMTQ0IiBoZWlnaHQ9IjE0NCIgdmlld0JveD0iMCAwIDE0NCAxNDQiIGZpbGw9Im5vbmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+CjxyZWN0IHdpZHRoPSIxNDQiIGhlaWdodD0iMTQ0IiByeD0iMjQi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cgMTIzLjA5NCAxMTguMDU0Wk0xMjUuODY2IDExNS42NDlDMTI3LjU0NCAxMTQuNDc0IDEyNS44NTcgMTExLjc1NSAxMjMuOTgxIDExMi42MUMxMjIuNDc5IDExMy4yOTQgMTIzLjExOSAxMTYuMTE1IDEyNC43NyAxMTYuMTY0QzEyNC45NjEgMTE2LjE2OSAxMjUuNDU0IDExNS45MzggMTI1Ljg2NiAxMTUuNjQ5Wk0xMjQuMzM5IDExNC41NzlDMTIzLjc3MSAxMTQuMzgxIDEyMy44MDMgMTEzLjI1NiAxMjQuMzgzIDExMy4wMzRDMTI0LjkwMiAxMTIuODM1IDEyNS42MDQgMTEzLjM5OCAxMjUuNjA0IDExNC4wMTRDMTI1LjYwNCAxMTQuNDg5IDEyNC45MzYgMTE0Ljc4NyAxMjQuMzM5IDExNC41NzlaTTExMi4zMTkgMTE2Ljk4QzEwOS45NiAxMTUuNjcgMTEwLjI4NiAxMTEuMDA2IDExMi40MTcgMTA4Ljk2NUMxMLine truncated
keysOrder: [["apiVersion"], ["appVersion"], ["kind"], ["metadata"], ["metadata", "name"], ["spec", "host"], ["spec", "topology"], ["spec", "replicationFactor"], ["spec", "db"], ["spec", "db", "replicas"], ["spec", "db", "size"], ["spec", "db", "storageClass"], ["spec", "db", "resources"], ["spec", "db", "resourcesPreset"], ["spec", "master"], ["spec", "master", "replicas"], ["spec", "master", "resources"], ["spec", "master", "resourcesPreset"], ["spec", "master", "volumeSizeLimitMB"], ["spec", "filer"], ["spec", "filer", "replicas"], ["spec", "filer", "resources"], ["spec", "filer", "resourcesPreset"], ["spec", "filer", "grpcHost"], ["spec", "filer", "grpcPort"], ["spec", "filer", "whitelist"], ["spec", "volume"], ["spec", "volume", "replicas"], ["spec", "volume", "size"], ["spec", "volume", "storageClass"], ["spec", "volume", "diskType"], ["spec", "volume", "resources"], ["spec", "volume", "resourcesPreset"], ["spec", "volume", "zones"], ["spec", "volume", "pools"], ["spec", "s3"], ["spec", "s3", "replicas"], ["spec", "s3", "resources"], ["spec", "s3", "resourcesPreset"]]
keysOrder: [["apiVersion"], ["appVersion"], ["kind"], ["metadata"], ["metadata", "name"], ["spec", "host"], ["spec", "topology"], ["spec", "replicationFactor"], ["spec", "db"], ["spec", "db", "replicas"], ["spec", "db", "size"], ["spec", "db", "storageClass"], ["spec", "db", "resources"], ["spec", "db", "resourcesPreset"], ["spec", "master"], ["spec", "master", "replicas"], ["spec", "master", "resources"], ["spec", "master", "resourcesPreset"], ["spec", "master", "volumeSizeLimitMB"], ["spec", "filer"], ["spec", "filer", "replicas"], ["spec", "filer", "resources"], ["spec", "filer", "resourcesPreset"], ["spec", "filer", "grpcHost"], ["spec", "filer", "grpcPort"], ["spec", "filer", "whitelist"], ["spec", "volume"], ["spec", "volume", "replicas"], ["spec", "volume", "size"], ["spec", "volume", "storageClass"], ["spec", "volume", "diskType"], ["spec", "volume", "resources"], ["spec", "volume", "resourcesPreset"], ["spec", "volume", "zones"], ["spec", "volume", "pools"], ["spec", "s3"], ["spec", "s3", "replicas"], ["spec", "s3", "resources"], ["spec", "s3", "resourcesPreset"], ["spec", "lifecycle"], ["spec", "lifecycle", "enabled"]]
secrets:
exclude: []
include: []
@@ -0,0 +1,138 @@
suite: seaweedfs runs the S3 lifecycle worker
# SeaweedFS stores a bucket lifecycle configuration on PUT and acts on it only
# from the s3_lifecycle job of the plugin worker, which the admin server
# schedules (weed/worker/tasks/s3_lifecycle/handler.go). Without an admin and a
# worker in the release, a rule is accepted and nothing ever expires.
templates:
- charts/seaweedfs/templates/admin/admin-statefulset.yaml
- charts/seaweedfs/templates/worker/worker-deployment.yaml
release:
name: seaweedfs-system
namespace: tenant-root
tests:
- it: runs the admin server that schedules lifecycle jobs
template: charts/seaweedfs/templates/admin/admin-statefulset.yaml
set: &enabled
seaweedfs:
admin:
enabled: true
secret:
existingSecret: seaweedfs-admin-credentials
worker:
enabled: true
asserts:
- isKind:
of: StatefulSet
- equal:
path: metadata.name
value: seaweedfs-admin
# The admin keeps its job state and any change an operator makes in its UI
# in -dataDir; on an emptyDir a restart would silently undo them.
- it: keeps the admin data directory on a persistent volume
template: charts/seaweedfs/templates/admin/admin-statefulset.yaml
set: *enabled
asserts:
- matchRegex:
path: spec.template.spec.containers[0].command[2]
pattern: '-dataDir=/data'
- equal:
path: spec.volumeClaimTemplates[0].metadata.name
value: admin-data
- equal:
path: spec.volumeClaimTemplates[0].spec.resources.requests.storage
value: 1Gi
- it: runs the worker against the admin of the same release
template: charts/seaweedfs/templates/worker/worker-deployment.yaml
set: *enabled
asserts:
- isKind:
of: Deployment
- matchRegex:
path: spec.template.spec.containers[0].command[2]
pattern: '-admin=seaweedfs-admin\.tenant-root:23646\.33646 '
# The worker executes every job type it registers for. Lifecycle is the only
# one this release asks for: vacuum, balance and erasure coding move data and
# are not something enabling lifecycle should start doing as a side effect.
- it: registers the worker for the s3_lifecycle job only
template: charts/seaweedfs/templates/worker/worker-deployment.yaml
set: *enabled
asserts:
- matchRegex:
path: spec.template.spec.containers[0].command[2]
pattern: '-jobType=s3_lifecycle '
- it: runs no Lance worker container, since the Lance catalog is off
template: charts/seaweedfs/templates/worker/worker-deployment.yaml
set: *enabled
asserts:
- lengthEqual:
path: spec.template.spec.containers
count: 1
- it: gives the admin and the worker explicit resources
set: *enabled
asserts:
- exists:
path: spec.template.spec.containers[0].resources.requests.memory
template: charts/seaweedfs/templates/admin/admin-statefulset.yaml
- exists:
path: spec.template.spec.containers[0].resources.limits.memory
template: charts/seaweedfs/templates/admin/admin-statefulset.yaml
- equal:
path: spec.template.spec.containers[0].resources.requests.memory
value: 64Mi
template: charts/seaweedfs/templates/worker/worker-deployment.yaml
# The admin serves an unauthenticated UI unless a password is set, and a
# tenant namespace admits ingress from the whole cluster. The credentials come
# from a Secret the parent release keeps; the values here only wire them in.
- it: reads the admin credentials from the named Secret
template: charts/seaweedfs/templates/admin/admin-statefulset.yaml
set: *enabled
asserts:
- contains:
path: spec.template.spec.containers[0].env
content:
name: WEED_ADMIN_PASSWORD
valueFrom:
secretKeyRef:
name: seaweedfs-admin-credentials
key: adminPassword
- contains:
path: spec.template.spec.containers[0].env
content:
name: WEED_ADMIN_USER
valueFrom:
secretKeyRef:
name: seaweedfs-admin-credentials
key: adminUser
- it: renders neither the admin nor the worker unless the parent turns them on
asserts:
- hasDocuments:
count: 0
template: charts/seaweedfs/templates/admin/admin-statefulset.yaml
- hasDocuments:
count: 0
template: charts/seaweedfs/templates/worker/worker-deployment.yaml
# Every other component here logs to stderr; the upstream default for these
# two writes to a file in an emptyDir that kubectl logs never shows.
- it: logs the admin and the worker to stderr
set: *enabled
asserts:
- matchRegex:
path: spec.template.spec.containers[0].command[2]
pattern: '-logtostderr=true'
template: charts/seaweedfs/templates/admin/admin-statefulset.yaml
- matchRegex:
path: spec.template.spec.containers[0].command[2]
pattern: '-logtostderr=true'
template: charts/seaweedfs/templates/worker/worker-deployment.yaml
+41
View File
@@ -319,6 +319,47 @@ seaweedfs:
region: ""
sidecar:
image: "ghcr.io/cozystack/cozystack/objectstorage-sidecar:v1.6.0@sha256:4d665becd3399c2fe1e8a66e15d14d16e4a5a75395fb0ae65cff46679a8989f1"
# A bucket lifecycle rule is stored on PUT and acted on only by the
# s3_lifecycle job of the plugin worker, scheduled by the admin server once a
# day (weed/worker/tasks/s3_lifecycle/handler.go at 4.45). The parent chart
# sends both enabled flags from its lifecycle.enabled, together with the
# admin password below; off here, so a render without the parent never
# starts an admin without one.
admin:
enabled: false
# Without a password weed admin serves its UI unauthenticated, and a tenant
# namespace admits ingress from the whole cluster. The parent chart names
# the Secret it keeps; these are the keys it writes.
secret:
userKey: adminUser
pwKey: adminPassword
# Job state and anything changed in the admin UI live in -dataDir.
data:
type: "persistentVolumeClaim"
size: "1Gi"
logs:
type: ""
resources:
requests:
cpu: "50m"
memory: "64Mi"
limits:
cpu: "500m"
memory: "256Mi"
worker:
enabled: false
# Vacuum, balance and erasure coding move data; enabling lifecycle must
# not start them.
jobType: "s3_lifecycle"
logs:
type: ""
resources:
requests:
cpu: "50m"
memory: "64Mi"
limits:
cpu: "1"
memory: "512Mi"
certificates:
commonName: "SeaweedFS CA"
ipAddresses: []