Skip to content

Commit 0e2f179

Browse files
committed
feat(storage): change minio to rustfs
1 parent 2b7e2f5 commit 0e2f179

8 files changed

Lines changed: 152 additions & 36 deletions

File tree

Dockerfile

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,16 @@ FROM registry.drycc.cc/drycc/base:${CODENAME}
44
ARG DRYCC_UID=1001 \
55
DRYCC_GID=1001 \
66
DRYCC_HOME_DIR=/data \
7-
MINIO_VERSION="2025.09.07.16.13.09"
7+
RUSTFS_VERSION="1.0.0-alpha.67" \
8+
OPENTELEMETRY_COLLECTOR_VERSION=0.139.0
89

10+
COPY rootfs/etc/otelcol /etc/otelcol
911

1012
RUN groupadd drycc --gid ${DRYCC_GID} \
1113
&& useradd drycc -u ${DRYCC_UID} -g ${DRYCC_GID} -s /bin/bash -m -d ${DRYCC_HOME_DIR} \
12-
&& install-stack minio $MINIO_VERSION \
14+
&& install-packages dnsutils \
15+
&& install-stack rustfs $RUSTFS_VERSION \
16+
&& install-stack opentelemetry-collector $OPENTELEMETRY_COLLECTOR_VERSION \
1317
&& rm -rf \
1418
/usr/share/doc \
1519
/usr/share/man \

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ We welcome your input! If you have feedback, please submit an [issue][issues]. I
1010

1111
# About
1212

13-
The Drycc storage component provides an [S3 API][s3-api] compatible object storage server, based on [MINIO](https://github.com/minio/minio), that can be run on Kubernetes. It's intended for use within the [Drycc v2 platform][drycc-docs] as an object storage server, but it's flexible enough to be run as a standalone pod on any Kubernetes cluster.
13+
The Drycc storage component provides an [S3 API][s3-api] compatible object storage server, based on [RUSTFS](https://github.com/rustfs/rustfs), that can be run on Kubernetes. It's intended for use within the [Drycc v2 platform][drycc-docs] as an object storage server, but it's flexible enough to be run as a standalone pod on any Kubernetes cluster.
1414

1515
Note that in the default [Helm chart for the Drycc platform](https://github.com/drycc/charts/tree/main/drycc-dev), this component is used as a storage location for the following components:
1616

_tests/test.sh

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,16 @@
11
#!/usr/bin/env bash
22

33
BASE_DIR=$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")
4-
MINIO_ROOT_USER=f4c4281665bc11ee8e0400163e04a9cd
5-
MINIO_ROOT_PASSWORD=f4c4281665bc11ee8e0400163e04a9cd
4+
RUSTFS_ACCESS_KEY=f4c4281665bc11ee8e0400163e04a9cd
5+
RUSTFS_SECRET_KEY=f4c4281665bc11ee8e0400163e04a9cd
66

77
function start-storage {
88
mkdir -p "${BASE_DIR}/data"
99
podman run --rm -d --name test-storage \
10-
-e MINIO_PROMETHEUS_AUTH_TYPE=public \
11-
-e MINIO_ROOT_USER=${MINIO_ROOT_USER} \
12-
-e MINIO_ROOT_PASSWORD=${MINIO_ROOT_PASSWORD} \
10+
-e RUSTFS_ACCESS_KEY=${RUSTFS_ACCESS_KEY} \
11+
-e RUSTFS_SECRET_KEY=${RUSTFS_SECRET_KEY} \
1312
registry.drycc.cc/drycc/storage:canary \
14-
minio server /tmp --address :9000 --console-address :9001
13+
rustfs /tmp --address :9000 --console-address :9001
1514
}
1615

1716
# shellcheck disable=SC2317
@@ -37,8 +36,8 @@ function main {
3736
type = s3
3837
provider = Other
3938
endpoint = ${S3_ENDPOINT}
40-
access_key_id = ${MINIO_ROOT_USER}
41-
secret_access_key = ${MINIO_ROOT_PASSWORD}
39+
access_key_id = ${RUSTFS_ACCESS_KEY}
40+
secret_access_key = ${RUSTFS_SECRET_KEY}
4241
EOF
4342
rclone --config /tmp/.config/rclone/rclone.conf mkdir storage:test
4443
rclone --config /tmp/.config/rclone/rclone.conf copyto "${BASE_DIR}"/test.sh storage:test/test.sh

charts/storage/Chart.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ dependencies:
66
- name: common
77
repository: oci://registry.drycc.cc/charts
88
version: ~1.1.2
9-
description: Minio Object Storage in Kubernetes, used by Drycc Workflow.
9+
description: Object Storage in Kubernetes, used by Drycc Workflow.
1010
maintainers:
1111
- name: Drycc Team
1212
email: engineering@drycc.com

charts/storage/templates/storage-service.yaml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,9 @@ kind: Service
33
metadata:
44
name: drycc-storage
55
annotations:
6-
prometheus.io/path: /minio/v2/metrics/cluster
7-
prometheus.io/port: "9000"
6+
prometheus.io/path: /metrics
7+
prometheus.io/port: "9200"
88
prometheus.io/scrape: "true"
9-
prometheus.io/direct: "true"
109
{{- with .Values.service.annotations }}
1110
{{- toYaml . | nindent 4 }}
1211
{{- end }}
@@ -23,3 +22,5 @@ spec:
2322
port: 9000
2423
- name: console
2524
port: 9001
25+
- name: metrics
26+
port: 9200

charts/storage/templates/storage-statefulset.yaml

Lines changed: 96 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,19 @@
11
{{- $zoneCount := int .Values.zones }}
22
{{- $driveCount := int .Values.drivesPerNode }}
33
{{- $replicaCount := int .Values.replicas }}
4+
{{- $volumesList := list }}
5+
{{- $hostsList := list }}
6+
{{- range $i := until $zoneCount }}
7+
{{- $factor := mul $i $replicaCount }}
8+
{{- $endIndex := sub (add $factor $replicaCount) 1 }}
9+
{{- $beginIndex := mul $i $replicaCount }}
10+
{{- $volumes := (printf "http://drycc-storage-{%d...%d}.drycc-storage:9000/data/{0...%d}" $beginIndex $endIndex (sub $driveCount 1) ) }}
11+
{{- $volumesList = append $volumesList $volumes }}
12+
{{- range $j := until $replicaCount }}
13+
{{- $nodeIndex := add $factor $j }}
14+
{{- $hostsList = append $hostsList (printf "drycc-storage-%d.drycc-storage" $nodeIndex) }}
15+
{{- end }}
16+
{{- end }}
417
apiVersion: apps/v1
518
kind: StatefulSet
619
metadata:
@@ -20,6 +33,10 @@ spec:
2033
app: drycc-storage
2134
template:
2235
metadata:
36+
annotations:
37+
prometheus.io/path: /metrics
38+
prometheus.io/port: "8888"
39+
prometheus.io/scrape: "true"
2340
labels:
2441
app: drycc-storage
2542
spec:
@@ -28,19 +45,42 @@ spec:
2845
podAntiAffinity: {{- include "common.affinities.pods" (dict "type" .Values.podAntiAffinityPreset.type "component" "" "extraMatchLabels" .Values.podAntiAffinityPreset.extraMatchLabels "topologyKey" "" "context" $) | nindent 10 }}
2946
nodeAffinity: {{- include "common.affinities.nodes" (dict "type" .Values.nodeAffinityPreset.type "key" .Values.nodeAffinityPreset.key "values" .Values.nodeAffinityPreset.values ) | nindent 10 }}
3047
serviceAccount: drycc-storage
48+
initContainers:
49+
- name: dns-check
50+
image: {{.Values.imageRegistry}}/{{.Values.imageOrg}}/storage:{{.Values.imageTag}}
51+
imagePullPolicy: {{.Values.imagePullPolicy}}
52+
command:
53+
- /usr/bin/env
54+
- bash
55+
- -ec
56+
- |
57+
echo "Checking DNS resolution for storage hosts..."
58+
# Check all hosts in hostsList
59+
hosts=({{- range $host := $hostsList }} "{{$host}}"{{- end }})
60+
for host in "${hosts[@]}"; do
61+
echo "Checking DNS resolution for $host..."
62+
while true; do
63+
if nslookup "$host" > /dev/null 2>&1; then
64+
echo "DNS resolution for $host: OK"
65+
break
66+
else
67+
echo "DNS resolution for $host failed, retrying in 5 seconds..."
68+
sleep 5
69+
fi
70+
done
71+
done
72+
echo "All DNS checks passed, ready to start storage containers."
3173
containers:
3274
- name: drycc-storage
3375
image: {{.Values.imageRegistry}}/{{.Values.imageOrg}}/storage:{{.Values.imageTag}}
3476
imagePullPolicy: {{.Values.imagePullPolicy}}
3577
env:
36-
- name: MINIO_PROMETHEUS_AUTH_TYPE
37-
value: "public"
38-
- name: "MINIO_ROOT_USER"
78+
- name: "RUSTFS_ACCESS_KEY"
3979
valueFrom:
4080
secretKeyRef:
4181
name: storage-creds
4282
key: accesskey
43-
- name: "MINIO_ROOT_PASSWORD"
83+
- name: "RUSTFS_SECRET_KEY"
4484
valueFrom:
4585
secretKeyRef:
4686
name: storage-creds
@@ -58,7 +98,7 @@ spec:
5898
{{- end }}
5999
livenessProbe:
60100
httpGet:
61-
path: /minio/health/live
101+
path: /health
62102
port: 9000
63103
initialDelaySeconds: 5
64104
periodSeconds: 5
@@ -76,30 +116,67 @@ spec:
76116
startupProbe:
77117
tcpSocket:
78118
port: 9000
79-
initialDelaySeconds: 0
119+
initialDelaySeconds: 30
80120
periodSeconds: 10
81121
timeoutSeconds: 5
82122
successThreshold: 1
83123
failureThreshold: 60
84124
args:
85-
- minio
86-
- server
87-
{{- $clusters := list }}
88-
{{- range $i := until $zoneCount }}
89-
{{- $factor := mul $i $replicaCount }}
90-
{{- $endIndex := sub (add $factor $replicaCount) 1 }}
91-
{{- $beginIndex := mul $i $replicaCount }}
92-
- {{(printf "http://drycc-storage-{%d...%d}.drycc-storage:9000/data/{0...%d}" $beginIndex $endIndex (sub $driveCount 1) ) }}
93-
{{- end }}
94-
- --address
95-
- :9000
96-
- --console-address
97-
- :9001
125+
- rustfs
126+
- {{ join " " $volumesList }}
127+
- --address=:9000
128+
- --console-address=:9001
129+
- --obs-endpoint=http://localhost:4317
98130
volumeMounts:
99131
{{- range $diskId := until $driveCount }}
100132
- name: storage-data-{{$diskId}}
101133
mountPath: /data/{{$diskId}}
102134
{{- end }}
135+
- name: drycc-storage-otelcol
136+
image: {{.Values.imageRegistry}}/{{.Values.imageOrg}}/storage:{{.Values.imageTag}}
137+
imagePullPolicy: {{.Values.imagePullPolicy}}
138+
ports:
139+
- name: receiver
140+
containerPort: 4317
141+
protocol: TCP
142+
- name: otelcol
143+
containerPort: 9200
144+
protocol: TCP
145+
- name: metrics
146+
containerPort: 8888
147+
protocol: TCP
148+
{{- with index .Values "resources" }}
149+
resources:
150+
{{- toYaml . | nindent 10 }}
151+
{{- end }}
152+
livenessProbe:
153+
httpGet:
154+
path: /metrics
155+
port: 9200
156+
initialDelaySeconds: 5
157+
periodSeconds: 5
158+
timeoutSeconds: 5
159+
successThreshold: 1
160+
failureThreshold: 5
161+
readinessProbe:
162+
tcpSocket:
163+
port: 9200
164+
initialDelaySeconds: 5
165+
periodSeconds: 5
166+
timeoutSeconds: 1
167+
successThreshold: 1
168+
failureThreshold: 5
169+
startupProbe:
170+
tcpSocket:
171+
port: 9200
172+
initialDelaySeconds: 30
173+
periodSeconds: 10
174+
timeoutSeconds: 5
175+
successThreshold: 1
176+
failureThreshold: 60
177+
args:
178+
- otelcol
179+
- --config=/etc/otelcol/otelcol.yaml
103180
securityContext:
104181
fsGroup: 1001
105182
runAsGroup: 1001

charts/storage/values.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ resources: {}
1111
# cpu: 100m
1212
# memory: 30Mi
1313

14-
# The following parameters are configured only when using an on-cluster Minio instance
14+
# The following parameters are configured only when using an on-cluster object storage instance
1515
nodeAffinityPreset:
1616
key: "drycc.cc/node"
1717
type: "soft"
@@ -28,7 +28,7 @@ podAntiAffinityPreset:
2828

2929
# Number of replicas per zone
3030
replicas: 4
31-
# Minio zone count
31+
# Object storage zone count
3232
zones: 1
3333
# Device count of per replica
3434
drivesPerNode: 1

rootfs/etc/otelcol/otelcol.yaml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# Simplified version: Focus on OTLP metrics collection and Prometheus export
2+
receivers:
3+
otlp: # OTLP protocol receiver
4+
protocols:
5+
grpc: # OTLP gRPC receiver for rustfs metrics data
6+
endpoint: 0.0.0.0:4317 # gRPC endpoint for receiving metrics
7+
processors:
8+
batch: # Batch processor to improve throughput
9+
timeout: 5s # Maximum time to wait before sending a batch
10+
send_batch_size: 1000 # Maximum batch size
11+
memory_limiter: # Memory limiter to prevent OOM
12+
check_interval: 1s # Interval to check memory usage
13+
limit_mib: 256 # Reduce memory limit to 256MB
14+
exporters:
15+
prometheus: # Prometheus exporter for Grafana scraping
16+
endpoint: "0.0.0.0:9200" # Endpoint for Grafana to scrape metrics
17+
namespace: "rustfs" # Metrics prefix (will prefix all metrics with "rustfs_")
18+
send_timestamps: true # Include timestamps with metrics
19+
service:
20+
pipelines:
21+
metrics: # Keep only metrics pipeline
22+
receivers: [otlp] # Receive OTLP metrics from rustfs
23+
processors: [memory_limiter, batch] # Apply memory limiting and batching
24+
exporters: [prometheus] # Export to Prometheus for Grafana
25+
telemetry:
26+
logs:
27+
level: "warn" # Reduce log level to minimize output
28+
metrics:
29+
readers:
30+
- pull:
31+
exporter:
32+
prometheus:
33+
host: 0.0.0.0 # Host for internal metrics endpoint
34+
port: 8888 # Port for internal metrics endpoint
35+
without_units: true # Export metrics without units for compatibility

0 commit comments

Comments
 (0)