mirror of
https://github.com/rustfs/rustfs.git
synced 2026-08-19 19:16:17 +00:00
e2f394a897
* 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>
306 lines
11 KiB
YAML
306 lines
11 KiB
YAML
{{- $logDir := .Values.config.rustfs.obs_log_directory }}
|
|
{{- $logDirEnabled := ne $logDir "" }}
|
|
{{- $poolsEnabled := and .Values.pools .Values.pools.enabled }}
|
|
{{- if and .Values.mode.distributed.enabled (le (int .Values.replicaCount) 1) -}}
|
|
{{- fail "Distributed mode requires replicaCount >= 2" -}}
|
|
{{- end -}}
|
|
|
|
{{- if .Values.mode.distributed.enabled }}
|
|
{{- range $pool := include "rustfs.pools" . | fromJsonArray }}
|
|
{{- $drivesPerNode := int $pool.drives }}
|
|
---
|
|
apiVersion: apps/v1
|
|
kind: StatefulSet
|
|
metadata:
|
|
name: {{ $pool.fullname }}
|
|
namespace: {{ $.Release.Namespace }}
|
|
labels:
|
|
{{- include "rustfs.labels" $ | nindent 4 }}
|
|
{{- if $poolsEnabled }}
|
|
rustfs.com/pool: {{ $pool.index | quote }}
|
|
{{- end }}
|
|
{{- with $.Values.commonLabels }}
|
|
{{- toYaml . | nindent 4 }}
|
|
{{- end }}
|
|
spec:
|
|
serviceName: {{ include "rustfs.fullname" $ }}-headless
|
|
replicas: {{ $pool.replicaCount }}
|
|
podManagementPolicy: Parallel
|
|
selector:
|
|
matchLabels:
|
|
{{- include "rustfs.selectorLabels" $ | nindent 6 }}
|
|
{{- if gt (int $pool.index) 0 }}
|
|
{{- /* Pool 0 keeps the legacy selector: it is immutable on existing
|
|
StatefulSets and must not change when pools are enabled. */}}
|
|
rustfs.com/pool: {{ $pool.index | quote }}
|
|
{{- end }}
|
|
template:
|
|
metadata:
|
|
labels:
|
|
{{- include "rustfs.selectorLabels" $ | nindent 8 }}
|
|
{{- if $poolsEnabled }}
|
|
rustfs.com/pool: {{ $pool.index | quote }}
|
|
{{- end }}
|
|
{{- with $.Values.podLabels }}
|
|
{{- toYaml . | nindent 8 }}
|
|
{{- end }}
|
|
{{- with $.Values.podAnnotations }}
|
|
annotations:
|
|
{{- toYaml . | nindent 8 }}
|
|
{{- end }}
|
|
spec:
|
|
serviceAccountName: {{ include "rustfs.serviceAccountName" $ }}
|
|
enableServiceLinks: {{ $.Values.enableServiceLinks }}
|
|
{{- with include "chart.imagePullSecrets" $ }}
|
|
imagePullSecrets:
|
|
{{- . | nindent 8 }}
|
|
{{- end }}
|
|
{{- if and $.Values.nodeSelector (not $.Values.affinity.nodeAffinity) }}
|
|
nodeSelector:
|
|
{{- toYaml $.Values.nodeSelector | nindent 8 }}
|
|
{{- end }}
|
|
{{- if $.Values.affinity }}
|
|
affinity:
|
|
nodeAffinity:
|
|
{{- if $.Values.affinity.nodeAffinity }}
|
|
{{- toYaml $.Values.affinity.nodeAffinity | nindent 10 }}
|
|
{{- else }}
|
|
{}
|
|
{{- end }}
|
|
{{- if $.Values.affinity.podAntiAffinity.enabled }}
|
|
podAntiAffinity:
|
|
{{- if $poolsEnabled }}
|
|
{{- /* Pool-scoped and PREFERRED, not required: during in-place
|
|
expansion the not-yet-rolled pods' required rules block new
|
|
pods from their nodes, while the new pods' DNS must resolve
|
|
before the roll can proceed - required rules deadlock
|
|
expansion whenever the cluster has fewer nodes than total
|
|
pods. Soft anti-affinity converges (the scheduler still
|
|
spreads when capacity allows). */}}
|
|
preferredDuringSchedulingIgnoredDuringExecution:
|
|
- weight: 100
|
|
podAffinityTerm:
|
|
labelSelector:
|
|
matchExpressions:
|
|
- key: app.kubernetes.io/name
|
|
operator: In
|
|
values:
|
|
- {{ include "rustfs.name" $ }}
|
|
- key: rustfs.com/pool
|
|
operator: In
|
|
values:
|
|
- {{ $pool.index | quote }}
|
|
topologyKey: {{ $.Values.affinity.podAntiAffinity.topologyKey }}
|
|
{{- else }}
|
|
requiredDuringSchedulingIgnoredDuringExecution:
|
|
- labelSelector:
|
|
matchExpressions:
|
|
- key: app.kubernetes.io/name
|
|
operator: In
|
|
values:
|
|
- {{ include "rustfs.name" $ }}
|
|
topologyKey: {{ $.Values.affinity.podAntiAffinity.topologyKey }}
|
|
{{- end }}
|
|
{{- end }}
|
|
{{- end }}
|
|
{{- if $.Values.tolerations }}
|
|
tolerations:
|
|
{{- toYaml $.Values.tolerations | nindent 8 }}
|
|
{{- end }}
|
|
{{- if and $.Values.topologySpreadConstraints.enabled $.Values.topologySpreadConstraints.constraints }}
|
|
topologySpreadConstraints:
|
|
{{- toYaml $.Values.topologySpreadConstraints.constraints | nindent 8 }}
|
|
{{- end }}
|
|
priorityClassName: {{ $.Values.priorityClassName }}
|
|
securityContext:
|
|
{{- toYaml $.Values.podSecurityContext | nindent 8 }}
|
|
initContainers:
|
|
- name: init-step
|
|
image: "{{ $.Values.image.initImage.repository }}:{{ $.Values.image.initImage.tag }}"
|
|
imagePullPolicy: {{ $.Values.image.initImage.pullPolicy }}
|
|
securityContext:
|
|
{{- toYaml $.Values.containerSecurityContext | nindent 12 }}
|
|
env:
|
|
- name: DRIVES_PER_NODE
|
|
value: {{ $drivesPerNode | quote }}
|
|
command:
|
|
- sh
|
|
- -c
|
|
- |
|
|
if [ "$DRIVES_PER_NODE" -gt 1 ]; then
|
|
for i in $(seq 0 $(($DRIVES_PER_NODE - 1))); do
|
|
mkdir -p /data/rustfs$i
|
|
done
|
|
else
|
|
mkdir -p /data
|
|
fi
|
|
{{- if $logDirEnabled }}
|
|
mkdir -p /mnt/rustfs/logs
|
|
chmod 755 /mnt/rustfs/logs
|
|
{{- end }}
|
|
volumeMounts:
|
|
{{- if gt $drivesPerNode 1 }}
|
|
{{- range $i := until $drivesPerNode }}
|
|
- name: data-rustfs-{{ $i }}
|
|
mountPath: /data/rustfs{{ $i }}
|
|
{{- end }}
|
|
{{- else }}
|
|
- name: data
|
|
mountPath: /data
|
|
{{- end }}
|
|
{{- if $logDirEnabled }}
|
|
- name: logs
|
|
mountPath: /mnt/rustfs
|
|
{{- end }}
|
|
containers:
|
|
- name: {{ $.Chart.Name }}
|
|
image: "{{ $.Values.image.rustfs.repository }}:{{ $.Values.image.rustfs.tag | default $.Chart.AppVersion }}"
|
|
command: ["/usr/bin/rustfs"]
|
|
imagePullPolicy: {{ $.Values.image.rustfs.pullPolicy }}
|
|
securityContext:
|
|
{{- toYaml $.Values.containerSecurityContext | nindent 12 }}
|
|
ports:
|
|
- name: endpoint
|
|
containerPort: {{ $.Values.service.endpoint.port }}
|
|
- name: console
|
|
containerPort: {{ $.Values.service.console.port }}
|
|
{{- with $.Values.extraEnv }}
|
|
env:
|
|
{{- toYaml . | nindent 12 }}
|
|
{{- end }}
|
|
envFrom:
|
|
- configMapRef:
|
|
name: {{ include "rustfs.fullname" $ }}-config
|
|
- secretRef:
|
|
name: {{ include "rustfs.secretName" $ }}
|
|
resources:
|
|
{{- toYaml $.Values.resources | nindent 12 }}
|
|
{{- include "rustfs.probes" $ | nindent 10 }}
|
|
volumeMounts:
|
|
{{- if $.Values.mtls.enabled }}
|
|
- name: client-cert
|
|
mountPath: /opt/tls/client_cert.pem
|
|
subPath: client_cert.pem
|
|
- name: client-cert
|
|
mountPath: /opt/tls/client_key.pem
|
|
subPath: client_key.pem
|
|
- name: client-cert
|
|
mountPath: /opt/tls/client_ca.crt
|
|
subPath: client_ca.crt
|
|
- name: server-cert
|
|
mountPath: /opt/tls/rustfs_cert.pem
|
|
subPath: rustfs_cert.pem
|
|
- name: server-cert
|
|
mountPath: /opt/tls/rustfs_key.pem
|
|
subPath: rustfs_key.pem
|
|
- name: server-cert
|
|
mountPath: /opt/tls/ca.crt
|
|
subPath: ca.crt
|
|
{{- end }}
|
|
{{- with $.Values.extraVolumeMounts }}
|
|
{{- toYaml . | nindent 12 }}
|
|
{{- end }}
|
|
{{- if $logDirEnabled }}
|
|
- name: logs
|
|
mountPath: {{ $logDir }}
|
|
subPath: logs
|
|
{{- end }}
|
|
{{- if gt $drivesPerNode 1 }}
|
|
{{- range $i := until $drivesPerNode }}
|
|
- name: data-rustfs-{{ $i }}
|
|
mountPath: /data/rustfs{{ $i }}
|
|
{{- end }}
|
|
{{- else }}
|
|
- name: data
|
|
mountPath: /data
|
|
{{- end }}
|
|
{{- if or $.Values.mtls.enabled $.Values.extraVolumes }}
|
|
volumes:
|
|
{{- if $.Values.mtls.enabled }}
|
|
- name: server-cert
|
|
secret:
|
|
secretName: {{ include "rustfs.fullname" $ }}-server-tls
|
|
items:
|
|
- key: tls.crt
|
|
path: rustfs_cert.pem
|
|
- key: tls.key
|
|
path: rustfs_key.pem
|
|
- key: ca.crt
|
|
path: ca.crt
|
|
- name: client-cert
|
|
secret:
|
|
secretName: {{ include "rustfs.fullname" $ }}-client-tls
|
|
items:
|
|
- key: tls.crt
|
|
path: client_cert.pem
|
|
- key: tls.key
|
|
path: client_key.pem
|
|
- key: ca.crt
|
|
path: client_ca.crt
|
|
{{- end }}
|
|
{{- with $.Values.extraVolumes }}
|
|
{{- toYaml . | nindent 8 }}
|
|
{{- end }}
|
|
{{- end }}
|
|
volumeClaimTemplates:
|
|
{{- if $logDirEnabled }}
|
|
- apiVersion: v1
|
|
kind: PersistentVolumeClaim
|
|
metadata:
|
|
name: logs
|
|
labels:
|
|
{{- toYaml $.Values.commonLabels | nindent 10 }}
|
|
{{- $logAnn := (default (dict) $pool.storageclass.pvcAnnotations).logs | default (dict) -}}
|
|
{{- if gt (len $logAnn) 0 }}
|
|
annotations:
|
|
{{- toYaml $logAnn | nindent 10 }}
|
|
{{- end }}
|
|
spec:
|
|
accessModes: ["ReadWriteOnce"]
|
|
storageClassName: {{ $pool.storageclass.name }}
|
|
resources:
|
|
requests:
|
|
storage: {{ $pool.storageclass.logStorageSize }}
|
|
{{- end }}
|
|
{{- if gt $drivesPerNode 1 }}
|
|
{{- range $i := until $drivesPerNode }}
|
|
- apiVersion: v1
|
|
kind: PersistentVolumeClaim
|
|
metadata:
|
|
name: data-rustfs-{{ $i }}
|
|
labels:
|
|
{{- toYaml $.Values.commonLabels | nindent 10 }}
|
|
{{- $dataAnn := (default (dict) $pool.storageclass.pvcAnnotations).data | default (dict) -}}
|
|
{{- if gt (len $dataAnn) 0 }}
|
|
annotations:
|
|
{{- toYaml $dataAnn | nindent 10 }}
|
|
{{- end }}
|
|
spec:
|
|
accessModes: ["ReadWriteOnce"]
|
|
storageClassName: {{ $pool.storageclass.name }}
|
|
resources:
|
|
requests:
|
|
storage: {{ $pool.storageclass.dataStorageSize }}
|
|
{{- end }}
|
|
{{- else }}
|
|
- apiVersion: v1
|
|
kind: PersistentVolumeClaim
|
|
metadata:
|
|
name: data
|
|
labels:
|
|
{{- toYaml $.Values.commonLabels | nindent 10 }}
|
|
{{- $dataAnn := (default (dict) $pool.storageclass.pvcAnnotations).data | default (dict) -}}
|
|
{{- if gt (len $dataAnn) 0 }}
|
|
annotations:
|
|
{{- toYaml $dataAnn | nindent 10 }}
|
|
{{- end }}
|
|
spec:
|
|
accessModes: ["ReadWriteOnce"]
|
|
storageClassName: {{ $pool.storageclass.name }}
|
|
resources:
|
|
requests:
|
|
storage: {{ $pool.storageclass.dataStorageSize }}
|
|
{{- end }}
|
|
{{- end }}
|
|
{{- end }}
|