mirror of
https://github.com/cozystack/cozystack.git
synced 2026-03-02 22:59:06 +00:00
feat(seaweedfs): add per-pool COSI resources and optional storageClass inheritance
Make storageClass optional in storagePools — pools inherit from volume.storageClass when not explicitly set. Add full COSI resource set per storage pool: BucketClass, BucketClass-worm (Retain + object lock), BucketAccessClass readwrite, and BucketAccessClass readonly. Co-Authored-By: Claude <noreply@anthropic.com> Signed-off-by: Kirill Ilin <stitch14@yandex.ru>
This commit is contained in:
@@ -50,11 +50,11 @@
|
||||
| `volume.zones` | A map of zones for MultiZone topology. Each zone can have its own number of replicas and size. | `map[string]object` | `{}` |
|
||||
| `volume.zones[name].replicas` | Number of replicas in the zone. | `int` | `0` |
|
||||
| `volume.zones[name].size` | Zone storage size. | `quantity` | `""` |
|
||||
| `storagePools` | A map of storage pools. Each pool creates a separate Volume StatefulSet with its own disk type. | `map[string]object` | `{}` |
|
||||
| `storagePools[name].diskType` | SeaweedFS disk type tag (e.g., "ssd", "hdd", "nvme"). | `string` | `""` |
|
||||
| `storagePools` | A map of storage pools. Each pool creates a separate Volume StatefulSet with its own disk type. Unset fields inherit from volume.* settings. | `map[string]object` | `{}` |
|
||||
| `storagePools[name].diskType` | SeaweedFS disk type tag (e.g., "ssd", "hdd", "nvme"). Required. | `string` | `""` |
|
||||
| `storagePools[name].replicas` | Number of volume replicas. Defaults to volume.replicas. | `int` | `0` |
|
||||
| `storagePools[name].size` | Persistent Volume size. Defaults to volume.size. | `quantity` | `""` |
|
||||
| `storagePools[name].storageClass` | Kubernetes StorageClass for the pool. | `string` | `""` |
|
||||
| `storagePools[name].storageClass` | Kubernetes StorageClass for the pool. Defaults to volume.storageClass. | `string` | `""` |
|
||||
| `storagePools[name].resources` | Explicit CPU and memory configuration. When omitted, the preset defined in `resourcesPreset` is applied. | `object` | `{}` |
|
||||
| `storagePools[name].resources.cpu` | Number of CPU cores allocated. | `quantity` | `""` |
|
||||
| `storagePools[name].resources.memory` | Amount of memory allocated. | `quantity` | `""` |
|
||||
|
||||
@@ -26,9 +26,6 @@
|
||||
{{- if not (regexMatch "^[a-z0-9]+$" $pool.diskType) }}
|
||||
{{- fail (printf "storagePools.%s.diskType must be lowercase alphanumeric (got: %s)." $poolName $pool.diskType) }}
|
||||
{{- end }}
|
||||
{{- if not $pool.storageClass }}
|
||||
{{- fail (printf "storagePools.%s.storageClass is required." $poolName) }}
|
||||
{{- end }}
|
||||
{{- if not (regexMatch "^[a-z0-9]([a-z0-9.-]*[a-z0-9])?$" $poolName) }}
|
||||
{{- fail (printf "storagePools key '%s' must be a valid DNS label (lowercase alphanumeric and hyphens)." $poolName) }}
|
||||
{{- end }}
|
||||
@@ -157,7 +154,7 @@ spec:
|
||||
- name: data1
|
||||
type: "persistentVolumeClaim"
|
||||
size: "{{ $pool.size | default $zone.size | default $.Values.volume.size }}"
|
||||
storageClass: "{{ $pool.storageClass }}"
|
||||
storageClass: "{{ $pool.storageClass | default $.Values.volume.storageClass }}"
|
||||
maxVolumes: 0
|
||||
nodeSelector: |
|
||||
topology.kubernetes.io/zone: {{ $zoneName }}
|
||||
@@ -177,7 +174,7 @@ spec:
|
||||
- name: data1
|
||||
type: "persistentVolumeClaim"
|
||||
size: "{{ $pool.size | default $.Values.volume.size }}"
|
||||
storageClass: "{{ $pool.storageClass }}"
|
||||
storageClass: "{{ $pool.storageClass | default $.Values.volume.storageClass }}"
|
||||
maxVolumes: 0
|
||||
extraArgs:
|
||||
- "-disk={{ $pool.diskType }}"
|
||||
|
||||
@@ -10,11 +10,34 @@ deletionPolicy: Delete
|
||||
parameters:
|
||||
diskType: {{ $pool.diskType }}
|
||||
---
|
||||
kind: BucketClass
|
||||
apiVersion: objectstorage.k8s.io/v1alpha1
|
||||
metadata:
|
||||
name: {{ $.Release.Namespace }}-{{ $poolName }}-worm
|
||||
driverName: {{ $.Release.Namespace }}.seaweedfs.objectstorage.k8s.io
|
||||
deletionPolicy: Retain
|
||||
parameters:
|
||||
diskType: {{ $pool.diskType }}
|
||||
objectLockEnabled: "true"
|
||||
objectLockRetentionMode: COMPLIANCE
|
||||
objectLockRetentionDays: "36500"
|
||||
---
|
||||
kind: BucketAccessClass
|
||||
apiVersion: objectstorage.k8s.io/v1alpha1
|
||||
metadata:
|
||||
name: {{ $.Release.Namespace }}-{{ $poolName }}
|
||||
driverName: {{ $.Release.Namespace }}.seaweedfs.objectstorage.k8s.io
|
||||
authenticationType: KEY
|
||||
parameters:
|
||||
accessPolicy: readwrite
|
||||
---
|
||||
kind: BucketAccessClass
|
||||
apiVersion: objectstorage.k8s.io/v1alpha1
|
||||
metadata:
|
||||
name: {{ $.Release.Namespace }}-{{ $poolName }}-readonly
|
||||
driverName: {{ $.Release.Namespace }}.seaweedfs.objectstorage.k8s.io
|
||||
authenticationType: KEY
|
||||
parameters:
|
||||
accessPolicy: readonly
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
|
||||
@@ -291,10 +291,6 @@
|
||||
"default": {},
|
||||
"additionalProperties": {
|
||||
"type": "object",
|
||||
"required": [
|
||||
"diskType",
|
||||
"storageClass"
|
||||
],
|
||||
"properties": {
|
||||
"diskType": {
|
||||
"description": "SeaweedFS disk type tag (e.g., \"ssd\", \"hdd\", \"nvme\").",
|
||||
|
||||
@@ -103,11 +103,12 @@ volume:
|
||||
## @field {string} diskType - SeaweedFS disk type tag (e.g., "ssd", "hdd", "nvme").
|
||||
## @field {int} [replicas] - Number of volume replicas. Defaults to volume.replicas.
|
||||
## @field {quantity} [size] - Persistent Volume size. Defaults to volume.size.
|
||||
## @field {string} storageClass - Kubernetes StorageClass for the pool.
|
||||
## @field {string} [storageClass] - Kubernetes StorageClass for the pool. Defaults to volume.storageClass.
|
||||
## @field {Resources} [resources] - Explicit CPU and memory configuration. When omitted, the preset defined in `resourcesPreset` is applied.
|
||||
## @field {ResourcesPreset} [resourcesPreset] - Default sizing preset used when `resources` is omitted. Defaults to volume.resourcesPreset.
|
||||
|
||||
## @param {map[string]StoragePool} [storagePools] - A map of storage pools. Each pool creates a separate Volume StatefulSet with its own disk type.
|
||||
## @param {map[string]StoragePool} [storagePools] - A map of storage pools. Each pool creates a separate Volume StatefulSet
|
||||
## with its own disk type. Unset fields inherit from volume.* settings.
|
||||
## In Simple topology, one StatefulSet is created per pool. Pods from different pools may run on the same node.
|
||||
## In MultiZone topology, a StatefulSet is created for each zone×pool combination (e.g., zone1-fast, zone2-fast),
|
||||
## with each pinned to its zone via nodeSelector.
|
||||
|
||||
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user