mirror of
https://github.com/rustfs/rustfs.git
synced 2026-07-26 08:18:18 +00:00
feat(helm): flexible drivesPerNode topology with backward-compatible per-pool defaults (#4901)
* helm chart: one data drive per node - fix1 * refactor(helm): prevent negative or 0 replicaCount Co-authored-by: Copilot <copilot@github.com> * refactor(helm): remove env REPLICA_COUNT * feat(helm): default no logs directory to force stdout Co-authored-by: Copilot <copilot@github.com> * feat(helm): add drivesPerNode * feat(helm): correct default parity with 4 nodes / 1 drive per node * conditional render of RUSTFS_OBS_LOG_DIRECTORY * feat(chart): add table doc for parity * fix(chart): handle invalid annotation objects * fix(chart): move logging and obsevability options together; default for kubernetes output to stdout * feat(chart): better table doc for parity * fix(chart): leave RUSTFS_OBS_LOG_DIRECTORY empty, or the defaults will attempt to write to readonly fs * fix(chart): chart defaults as the previous version: 4 nodes with 4 drives per node * feat(chart): render RUSTFS_STORAGE_CLASS_STANDARD in configmap * minor fix for pvcAnnotations Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> Signed-off-by: Cristian Chiru <cristi.chiru@gmail.com> * fix(chart): better drivesPerNode handling * fix(chart): obs_log_directory default non empty again to preserve previous deployments compatibility * fix(chart): proper drivesPerNode impl * fix(chart): values clarification for empty vs unset `obs_log_directory` * feat(chart): add service externalIPs * feat(helm): add optional service labels * fix(helm): merge service labels * fix(helm): storageclass pvcAnnotations * fix(chart): move logging and obsevability options together; default for kubernetes output to stdout * fix(helm): remove duplicate keys * fix(helm): default drivesPerNode null, keep legacy chart behavior * feat(helm): add template test for externalIPs * fix(helm): per-pool drivesPerNode inference, restore regression tests Repairs the drivesPerNode feature from #2693 so it renders and stays upgrade-safe: - define the missing drives inference (rustfs.poolDrives) and compute it per pool inside rustfs.pools, so mixed 4x4 + 16x1 pool deployments keep their exact legacy volumeClaimTemplates when drivesPerNode is unset - restore the $poolsEnabled definition dropped in the rebase (chart failed to render at all) - fix .Values references inside the pool range (dot is the pool there) and keep per-pool storageclass pvcAnnotations overrides working - make rustfs.volumes derive the drive range from pool drives instead of the pod count, and relax the pools.list 4-or-16 restriction to >= 2 - reject drivesPerNode=0 explicitly instead of silently inferring - keep default rendering identical to main: storage_class_standard stays unrendered by default, obs_endpoint.use_stdout stays false, clusterDomain value restored - restore the clusterDomain/mTLS SAN/explicit-volumes regression tests that the branch deleted, keeping the new topology tests --------- Signed-off-by: Cristian Chiru <cristi.chiru@gmail.com> Co-authored-by: Cristian Chiru <cristi.chiru@gmail.com> Co-authored-by: Copilot <copilot@github.com> Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
This commit is contained in:
@@ -303,3 +303,70 @@ if grep -q 'svc\.cluster\.local"' <<<"$cert_custom"; then
|
||||
echo "Custom clusterDomain must fully replace cluster.local in mTLS server cert SANs" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Legacy topology compatibility: default replicaCount=4 (no drivesPerNode set)
|
||||
# must render the old 4x4 PVC names (data-rustfs-0 .. data-rustfs-3).
|
||||
legacy_four_by_four=$(render_distributed_statefulset)
|
||||
for i in 0 1 2 3; do
|
||||
if ! grep -q "name: data-rustfs-${i}" <<<"$legacy_four_by_four"; then
|
||||
echo "Legacy 4x4 topology must contain PVC data-rustfs-${i}" >&2
|
||||
exit 1
|
||||
fi
|
||||
done
|
||||
if grep -q "name: data$" <<<"$legacy_four_by_four"; then
|
||||
echo "Legacy 4x4 topology must NOT contain a single 'data' PVC" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Legacy topology compatibility: replicaCount=16 (no drivesPerNode set)
|
||||
# must render a single 'data' PVC (old 16x1 behaviour).
|
||||
legacy_sixteen_by_one=$(render_distributed_statefulset --set replicaCount=16)
|
||||
if ! grep -q "name: data$" <<<"$legacy_sixteen_by_one"; then
|
||||
echo "Legacy 16x1 topology must contain a single 'data' PVC" >&2
|
||||
exit 1
|
||||
fi
|
||||
if grep -q "name: data-rustfs-" <<<"$legacy_sixteen_by_one"; then
|
||||
echo "Legacy 16x1 topology must NOT contain data-rustfs-* PVCs" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Generic topology: explicit replicaCount=8 drivesPerNode=2 must render
|
||||
# exactly two PVCs per pod.
|
||||
generic_eight_by_two=$(render_distributed_statefulset --set replicaCount=8 --set drivesPerNode=2)
|
||||
for i in 0 1; do
|
||||
if ! grep -q "name: data-rustfs-${i}" <<<"$generic_eight_by_two"; then
|
||||
echo "Generic 8x2 topology must contain PVC data-rustfs-${i}" >&2
|
||||
exit 1
|
||||
fi
|
||||
done
|
||||
if grep -q "name: data$" <<<"$generic_eight_by_two"; then
|
||||
echo "Generic 8x2 topology must NOT contain a single 'data' PVC" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# volumeClaimTemplates must not contain empty annotations when pvcAnnotations are unset,
|
||||
# because Kubernetes treats annotations: {} as a mutation of the immutable field.
|
||||
no_ann_output=$(render_distributed_statefulset)
|
||||
if grep -A1 'kind: PersistentVolumeClaim' <<<"$no_ann_output" | grep -q 'annotations:'; then
|
||||
echo "Empty pvcAnnotations must not render an annotations key in volumeClaimTemplates" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Distributed mode with replicaCount < 2 must fail rendering.
|
||||
low_replica_status=0
|
||||
render_distributed_statefulset --set replicaCount=1 >/dev/null 2>&1 || low_replica_status=$?
|
||||
if [[ $low_replica_status -eq 0 ]]; then
|
||||
echo "Distributed mode with replicaCount=1 must fail rendering" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# service.externalIPs must render correctly when supplied.
|
||||
external_ips_output=$(helm template rustfs "$CHART_DIR" \
|
||||
--namespace rustfs \
|
||||
--set secret.rustfs.access_key=test-access-key \
|
||||
--set secret.rustfs.secret_key=test-secret-key \
|
||||
--set 'service.externalIPs[0]=203.0.113.1')
|
||||
if ! grep -A2 'externalIPs:' <<<"$external_ips_output" | grep -q '203.0.113.1'; then
|
||||
echo "service.externalIPs must contain 203.0.113.1" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user