Skip to content

SeaweedFS is a distributed storage system for object storage (S3), file systems, Iceberg table buckets, and Lance vector buckets, designed to handle billions of files with O(1) disk access and effortless horizontal scaling.

helm: apply placement values to the chart's hook Jobs (#11795)

Chris Lubc29ffbfbdef
diff --git a/k8s/charts/seaweedfs/templates/shared/post-install-bucket-hook.yaml b/k8s/charts/seaweedfs/templates/shared/post-install-bucket-hook.yaml
index f3722758be..11ea7feff6 100644
--- a/k8s/charts/seaweedfs/templates/shared/post-install-bucket-hook.yaml
+++ b/k8s/charts/seaweedfs/templates/shared/post-install-bucket-hook.yaml
@@ -18,9 +18,17 @@
{{- $clusterFilerKey := printf "WEED_CLUSTER_%s_FILER" $clusterUpper }}
{{- $podSecurityContext := .Values.filer.podSecurityContext }}
{{- $containerSecurityContext := .Values.filer.containerSecurityContext }}
+{{- $nodeSelector := .Values.filer.nodeSelector }}
+{{- $tolerations := .Values.filer.tolerations }}
+{{- $createBucketsHook := .Values.filer.s3.createBucketsHook }}
{{- if .Values.allInOne.enabled }}
{{- $podSecurityContext = .Values.allInOne.podSecurityContext }}
{{- $containerSecurityContext = .Values.allInOne.containerSecurityContext }}
+ {{- $nodeSelector = .Values.allInOne.nodeSelector }}
+ {{- $tolerations = .Values.allInOne.tolerations }}
+ {{- $createBucketsHook = .Values.allInOne.s3.createBucketsHook }}
+{{- else if .Values.s3.createBuckets }}
+ {{- $createBucketsHook = .Values.s3.createBucketsHook }}
{{- end }}
{{- /* Check allInOne mode first */}}
@@ -76,10 +84,18 @@ spec:
app.kubernetes.io/instance: {{ .Release.Name | quote }}
app.kubernetes.io/component: bucket-hook
spec:
+ {{- with $createBucketsHook.affinity }}
+ affinity:
+ {{ tpl . $ | indent 8 | trim }}
+ {{- end }}
restartPolicy: Never
{{- if $podSecurityContext.enabled }}
securityContext: {{- omit $podSecurityContext "enabled" | toYaml | nindent 8 }}
{{- end }}
+ {{- with coalesce $createBucketsHook.tolerations $tolerations }}
+ tolerations:
+ {{ tpl . $ | indent 8 | trim }}
+ {{- end }}
{{- include "seaweedfs.imagePullSecrets" $ | nindent 6 }}
containers:
- name: post-install-job
@@ -274,4 +290,8 @@ spec:
secretName: {{ include "seaweedfs.fullname" . }}-client-cert
{{- end }}
{{- end }}
+ {{- with coalesce $createBucketsHook.nodeSelector $nodeSelector }}
+ nodeSelector:
+ {{ tpl . $ | indent 8 | trim }}
+ {{- end }}
{{- end }}
diff --git a/k8s/charts/seaweedfs/templates/volume/volume-resize-hook.yaml b/k8s/charts/seaweedfs/templates/volume/volume-resize-hook.yaml
index 5680b7aa65..b6d3285722 100644
--- a/k8s/charts/seaweedfs/templates/volume/volume-resize-hook.yaml
+++ b/k8s/charts/seaweedfs/templates/volume/volume-resize-hook.yaml
@@ -30,11 +30,19 @@ spec:
app.kubernetes.io/instance: {{ .Release.Name | quote }}
app.kubernetes.io/component: volume-resize-hook
spec:
+ {{- with .Values.volume.resizeHook.affinity }}
+ affinity:
+ {{ tpl (printf "{{ $volumeName := \"volume\" }}%s" .) $ | indent 8 | trim }}
+ {{- end }}
serviceAccountName: {{ $seaweedfsName }}-volume-resize-hook
restartPolicy: Never
{{- if .Values.volume.podSecurityContext.enabled }}
securityContext: {{- omit .Values.volume.podSecurityContext "enabled" | toYaml | nindent 8 }}
{{- end }}
+ {{- with coalesce .Values.volume.resizeHook.tolerations .Values.volume.tolerations }}
+ tolerations:
+ {{ tpl (printf "{{ $volumeName := \"volume\" }}%s" .) $ | indent 8 | trim }}
+ {{- end }}
containers:
- name: resize
image: {{ .Values.volume.resizeHook.image }}
@@ -58,6 +66,10 @@ spec:
volumes:
{{- include "seaweedfs.tmpDirVolume" (list . .Values.volume.containerSecurityContext "" "" false) | nindent 8 }}
{{- end }}
+ {{- with coalesce .Values.volume.resizeHook.nodeSelector .Values.volume.nodeSelector }}
+ nodeSelector:
+ {{ tpl (printf "{{ $volumeName := \"volume\" }}%s" .) $ | indent 8 | trim }}
+ {{- end }}
---
apiVersion: v1
kind: ServiceAccount
diff --git a/k8s/charts/seaweedfs/values.yaml b/k8s/charts/seaweedfs/values.yaml
index ea10064de3..eff19c5dbc 100644
--- a/k8s/charts/seaweedfs/values.yaml
+++ b/k8s/charts/seaweedfs/values.yaml
@@ -437,6 +437,10 @@ volume:
resizeHook:
enabled: true
image: alpine/k8s:1.28.4
+ # nodeSelector and tolerations fall back to the volume server's when unset
+ nodeSelector: ""
+ tolerations: ""
+ affinity: ""
# idx (the volume index) may use a separate PERSISTENT volume:
#
@@ -1083,6 +1087,10 @@ filer:
# anonymousRead: false
createBucketsHook:
resources: {}
+ # nodeSelector and tolerations fall back to filer's when unset
+ nodeSelector: ""
+ tolerations: ""
+ affinity: ""
s3:
enabled: false
@@ -1305,6 +1313,10 @@ s3:
createBucketsHook:
resources: {}
+ # nodeSelector and tolerations fall back to filer's when unset
+ nodeSelector: ""
+ tolerations: ""
+ affinity: ""
ingress:
enabled: false
@@ -1927,6 +1939,10 @@ allInOne:
# anonymousRead: false
createBucketsHook:
resources: {}
+ # nodeSelector and tolerations fall back to allInOne's when unset
+ nodeSelector: ""
+ tolerations: ""
+ affinity: ""
# SFTP server configuration
# Note: Most parameters below default to null, which means they inherit from