Skip to content

Commit

Permalink
added weekly job
Browse files Browse the repository at this point in the history
Signed-off-by: Nikolay Demchuk <[email protected]>
  • Loading branch information
NikolayDemchuk committed Oct 1, 2024
1 parent fea67af commit b9991f4
Showing 1 changed file with 53 additions and 0 deletions.
53 changes: 53 additions & 0 deletions templates/metadata-backup/job_weekly.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
{{- define "metadata_backup_resources" }}
cpu: 10m
memory: 25Mi
{{- end }}

{{- if dig "backup" "enabled" true .Values.sdsReplicatedVolume }}
---
apiVersion: batch/v1
kind: CronJob
metadata:
name: metadata-scheduled-backup
namespace: d8-{{ .Chart.Name }}
spec:
schedule: {{ dig "backup" "schedule" "0 3 * * *" .Values.sdsReplicatedVolume }}
concurrencyPolicy: Forbid
failedJobsHistoryLimit: 1
jobTemplate:
spec:
template:
metadata:
namespace: d8-{{ .Chart.Name }}
labels:
app: metadata-backup
spec:
restartPolicy: OnFailure
{{- include "helm_lib_priority_class" (tuple . "cluster-medium") | nindent 10 }}
{{- include "helm_lib_node_selector" (tuple . "system") | nindent 10 }}
{{- include "helm_lib_tolerations" (tuple . "system") | nindent 10 }}
{{- include "helm_lib_module_pod_security_context_run_as_user_nobody" . | nindent 10 }}
imagePullSecrets:
- name: {{ .Chart.Name }}-module-registry
serviceAccount: metadata-backup
serviceAccountName: metadata-backup
containers:
- name: metadata-backup
{{- include "helm_lib_module_container_security_context_read_only_root_filesystem_capabilities_drop_all" . | nindent 12 }}
image: {{ include "helm_lib_module_image" (list . "metadataBackup") }}
imagePullPolicy: IfNotPresent
command:
- /backup.py
- --retentionCount
- {{ dig "backup" "retentionCount" "3" .Values.sdsReplicatedVolume | quote }}
volumeMounts:
- name: tmp
mountPath: /tmp
resources:
requests:
{{- include "helm_lib_module_ephemeral_storage_logs_with_extra" 10 | nindent 16 }}
{{- include "metadata_backup_resources" . | nindent 16 }}
volumes:
- name: tmp
emptyDir: {}
{{- end }}

0 comments on commit b9991f4

Please sign in to comment.