mirror of
https://github.com/rustfs/rustfs.git
synced 2026-08-08 06:13:14 +00:00
227 lines
7.8 KiB
YAML
227 lines
7.8 KiB
YAML
{{- $logDir := .Values.config.rustfs.obs_log_directory }}
|
|
|
|
{{- if .Values.mode.distributed.enabled }}
|
|
---
|
|
apiVersion: apps/v1
|
|
kind: StatefulSet
|
|
metadata:
|
|
name: {{ include "rustfs.fullname" . }}
|
|
namespace: {{ .Release.Namespace }}
|
|
labels:
|
|
{{- include "rustfs.labels" . | nindent 4 }}
|
|
{{- with .Values.commonLabels }}
|
|
{{- toYaml . | nindent 4 }}
|
|
{{- end }}
|
|
spec:
|
|
serviceName: {{ include "rustfs.fullname" . }}-headless
|
|
replicas: {{ .Values.replicaCount }}
|
|
podManagementPolicy: Parallel
|
|
selector:
|
|
matchLabels:
|
|
{{- include "rustfs.selectorLabels" . | nindent 6 }}
|
|
template:
|
|
metadata:
|
|
labels:
|
|
{{- include "rustfs.selectorLabels" . | nindent 8 }}
|
|
{{- with .Values.podLabels }}
|
|
{{- toYaml . | nindent 8 }}
|
|
{{- end }}
|
|
spec:
|
|
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:
|
|
requiredDuringSchedulingIgnoredDuringExecution:
|
|
- labelSelector:
|
|
matchExpressions:
|
|
- key: app.kubernetes.io/name
|
|
operator: In
|
|
values:
|
|
- {{ include "rustfs.name" . }}
|
|
topologyKey: {{ .Values.affinity.podAntiAffinity.topologyKey }}
|
|
{{- end }}
|
|
{{- end }}
|
|
{{- if .Values.tolerations }}
|
|
tolerations:
|
|
{{- toYaml .Values.tolerations | nindent 8 }}
|
|
{{- end }}
|
|
securityContext:
|
|
{{- toYaml .Values.podSecurityContext | nindent 8 }}
|
|
{{- if .Values.imagePullSecrets }}
|
|
imagePullSecrets:
|
|
{{- toYaml .Values.imagePullSecrets | nindent 8 }}
|
|
{{- end }}
|
|
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: REPLICA_COUNT
|
|
value: {{ .Values.replicaCount | quote }}
|
|
command:
|
|
- sh
|
|
- -c
|
|
- |
|
|
if [ "$REPLICA_COUNT" -eq 4 ]; then
|
|
for i in $(seq 0 $(($REPLICA_COUNT - 1))); do
|
|
mkdir -p /data/rustfs$i
|
|
done;
|
|
elif [ "$REPLICA_COUNT" -eq 16 ]; then
|
|
mkdir -p /data
|
|
fi
|
|
mkdir -p /mnt/rustfs/logs
|
|
chmod 755 /mnt/rustfs/logs
|
|
volumeMounts:
|
|
{{- if eq (int .Values.replicaCount) 4 }}
|
|
{{- range $i := until (int .Values.replicaCount) }}
|
|
- name: data-rustfs-{{ $i }}
|
|
mountPath: /data/rustfs{{ $i }}
|
|
{{- end }}
|
|
{{- else if eq (int .Values.replicaCount) 16 }}
|
|
- name: data
|
|
mountPath: /data
|
|
{{- end }}
|
|
- name: logs
|
|
mountPath: /mnt/rustfs
|
|
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 }}
|
|
envFrom:
|
|
- configMapRef:
|
|
name: {{ include "rustfs.fullname" . }}-config
|
|
- secretRef:
|
|
name: {{ include "rustfs.secretName" . }}
|
|
resources:
|
|
{{- toYaml .Values.resources | nindent 12 }}
|
|
{{- if .Values.livenessProbe.enabled }}
|
|
livenessProbe:
|
|
{{- omit .Values.livenessProbe "enabled" | toYaml | nindent 12 }}
|
|
{{- end }}
|
|
{{- if .Values.readinessProbe.enabled }}
|
|
readinessProbe:
|
|
{{- omit .Values.readinessProbe "enabled" | toYaml | nindent 12 }}
|
|
{{- end }}
|
|
volumeMounts:
|
|
{{- if .Values.mtls.enabled }}
|
|
{{- if not .Values.mtls.serverOnly }}
|
|
- 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
|
|
{{- end }}
|
|
- 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 }}
|
|
- name: logs
|
|
mountPath: {{ $logDir }}
|
|
subPath: logs
|
|
{{- if eq (int .Values.replicaCount) 4 }}
|
|
{{- range $i := until (int .Values.replicaCount) }}
|
|
- name: data-rustfs-{{ $i }}
|
|
mountPath: /data/rustfs{{ $i }}
|
|
{{- end }}
|
|
{{- else if eq (int .Values.replicaCount) 16 }}
|
|
- name: data
|
|
mountPath: /data
|
|
{{- end }}
|
|
{{- if .Values.mtls.enabled }}
|
|
volumes:
|
|
- name: server-cert
|
|
secret:
|
|
secretName: rustfs-server-tls
|
|
items:
|
|
- key: tls.crt
|
|
path: rustfs_cert.pem
|
|
- key: tls.key
|
|
path: rustfs_key.pem
|
|
- key: ca.crt
|
|
path: ca.crt
|
|
{{- if not .Values.mtls.serverOnly }}
|
|
- name: client-cert
|
|
secret:
|
|
secretName: rustfs-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 }}
|
|
{{- end }}
|
|
volumeClaimTemplates:
|
|
- metadata:
|
|
name: logs
|
|
labels:
|
|
{{- toYaml .Values.commonLabels | nindent 10 }}
|
|
spec:
|
|
accessModes: ["ReadWriteOnce"]
|
|
storageClassName: {{ .Values.storageclass.name }}
|
|
resources:
|
|
requests:
|
|
storage: {{ .Values.storageclass.logStorageSize }}
|
|
{{- if eq (int .Values.replicaCount) 4 }}
|
|
{{- range $i := until (int .Values.replicaCount) }}
|
|
- metadata:
|
|
name: data-rustfs-{{ $i }}
|
|
labels:
|
|
{{- toYaml $.Values.commonLabels | nindent 10 }}
|
|
spec:
|
|
accessModes: ["ReadWriteOnce"]
|
|
storageClassName: {{ $.Values.storageclass.name }}
|
|
resources:
|
|
requests:
|
|
storage: {{ $.Values.storageclass.dataStorageSize }}
|
|
{{- end }}
|
|
{{- else if eq (int .Values.replicaCount) 16 }}
|
|
- metadata:
|
|
name: data
|
|
labels:
|
|
{{- toYaml .Values.commonLabels | nindent 10 }}
|
|
spec:
|
|
accessModes: ["ReadWriteOnce"]
|
|
storageClassName: {{ .Values.storageclass.name }}
|
|
resources:
|
|
requests:
|
|
storage: {{ .Values.storageclass.dataStorageSize }}
|
|
{{- end }}
|
|
{{- end }}
|