mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2024-01-19 02:48:24 +00:00
commit
bc11d91892
|
@ -112,3 +112,17 @@ Inject extra environment vars in the format key:value, if populated
|
||||||
{{- printf "%s%s%s:%s" $registryName $repositoryName $name $tag -}}
|
{{- printf "%s%s%s:%s" $registryName $repositoryName $name $tag -}}
|
||||||
{{- end -}}
|
{{- end -}}
|
||||||
{{- end -}}
|
{{- end -}}
|
||||||
|
|
||||||
|
{{/* Return the proper cronjob image */}}
|
||||||
|
{{- define "cronjob.image" -}}
|
||||||
|
{{- if .Values.cronjob.imageOverride -}}
|
||||||
|
{{- $imageOverride := .Values.cronjob.imageOverride -}}
|
||||||
|
{{- printf "%s" $imageOverride -}}
|
||||||
|
{{- else -}}
|
||||||
|
{{- $registryName := default .Values.image.registry .Values.global.localRegistry | toString -}}
|
||||||
|
{{- $repositoryName := .Values.image.repository | toString -}}
|
||||||
|
{{- $name := .Values.global.imageName | toString -}}
|
||||||
|
{{- $tag := .Values.global.imageTag | toString -}}
|
||||||
|
{{- printf "%s%s%s:%s" $registryName $repositoryName $name $tag -}}
|
||||||
|
{{- end -}}
|
||||||
|
{{- end -}}
|
54
k8s/seaweedfs/templates/cronjob.yaml
Normal file
54
k8s/seaweedfs/templates/cronjob.yaml
Normal file
|
@ -0,0 +1,54 @@
|
||||||
|
{{- if .Values.cronjob }}
|
||||||
|
{{- if .Values.cronjob.enabled }}
|
||||||
|
apiVersion: batch/v1beta1
|
||||||
|
kind: CronJob
|
||||||
|
metadata:
|
||||||
|
name: {{ include "seaweedfs.fullname" . }}-cronjob
|
||||||
|
spec:
|
||||||
|
schedule: "{{ .Values.cronjob.schedule }}"
|
||||||
|
concurrencyPolicy: Forbid
|
||||||
|
failedJobsHistoryLimit: 2
|
||||||
|
successfulJobsHistoryLimit: 2
|
||||||
|
jobTemplate:
|
||||||
|
spec:
|
||||||
|
backoffLimit: 2
|
||||||
|
template:
|
||||||
|
spec:
|
||||||
|
{{- with .Values.cronjob.nodeSelector }}
|
||||||
|
nodeSelector:
|
||||||
|
{{- toYaml . | nindent 12 }}
|
||||||
|
{{- end }}
|
||||||
|
{{- with .Values.cronjob.tolerations }}
|
||||||
|
tolerations:
|
||||||
|
{{- toYaml . | nindent 12 }}
|
||||||
|
{{- end }}
|
||||||
|
restartPolicy: OnFailure
|
||||||
|
containers:
|
||||||
|
- name: shell
|
||||||
|
image: {{ template "cronjob.image" . }}
|
||||||
|
imagePullPolicy: {{ default "IfNotPresent" .Values.global.imagePullPolicy }}
|
||||||
|
resources:
|
||||||
|
{{- toYaml .Values.cronjob.resources| nindent 16 }}
|
||||||
|
command:
|
||||||
|
- sh
|
||||||
|
- -c
|
||||||
|
- |
|
||||||
|
set -ex
|
||||||
|
echo -e "lock\n\
|
||||||
|
volume.balance -force\
|
||||||
|
{{ if .Values.volume.dataCenter }} -dataCenter {{ .Values.volume.dataCenter }}{{ end }}\
|
||||||
|
{{ if .Values.cronjob.collection }} -collection {{ .Values.cronjob.collection }}{{ end }}\n\
|
||||||
|
volume.fix.replication\nunlock\n" | \
|
||||||
|
/usr/bin/weed shell \
|
||||||
|
{{- if .Values.cronjob.master }}
|
||||||
|
-master {{ .Values.cronjob.master }} \
|
||||||
|
{{- else }}
|
||||||
|
-master {{ template "seaweedfs.name" . }}-master.{{ .Release.Namespace }}.svc:{{ .Values.master.port }} \
|
||||||
|
{{- end }}
|
||||||
|
{{- if .Values.cronjob.filer }}
|
||||||
|
-filer {{ .Values.cronjob.filer }}
|
||||||
|
{{- else }}
|
||||||
|
-filer {{ template "seaweedfs.name" . }}-filer.{{ .Release.Namespace }}.svc:{{ .Values.filer.port }}
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
|
@ -347,6 +347,19 @@ s3:
|
||||||
# ref: https://kubernetes.io/docs/concepts/configuration/pod-priority-preemption/
|
# ref: https://kubernetes.io/docs/concepts/configuration/pod-priority-preemption/
|
||||||
priorityClassName: ""
|
priorityClassName: ""
|
||||||
|
|
||||||
|
cronjob:
|
||||||
|
enabled: false
|
||||||
|
schedule: "*/7 * * * *"
|
||||||
|
resources: null
|
||||||
|
# balance all volumes among volume servers
|
||||||
|
# ALL|EACH_COLLECTION|<collection_name>
|
||||||
|
collection: ""
|
||||||
|
master: ""
|
||||||
|
filer: ""
|
||||||
|
tolerations: ""
|
||||||
|
nodeSelector: |
|
||||||
|
sw-backend: "true"
|
||||||
|
|
||||||
certificates:
|
certificates:
|
||||||
commonName: "SeaweedFS CA"
|
commonName: "SeaweedFS CA"
|
||||||
ipAddresses: []
|
ipAddresses: []
|
||||||
|
|
Loading…
Reference in a new issue