|
|
@ -0,0 +1,51 @@ |
|
|
|
{{- 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 |
|
|
|
startingDeadlineSeconds: 300 |
|
|
|
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\nvolume.balance -force -dataCenter {{ .Values.dataCenter }}\nvolume.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 }} |