backup.yaml 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. apiVersion: batch/v1beta1
  2. kind: CronJob
  3. metadata:
  4. name: "{{ .Release.Name }}-job"
  5. labels:
  6. app.kubernetes.io/managed-by: {{ .Release.Service | quote }}
  7. app.kubernetes.io/instance: {{ .Release.Name | quote }}
  8. helm.sh/chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
  9. app.kubernetes.io/name: "graph-backup"
  10. app.kubernetes.io/component: backup
  11. spec:
  12. schedule: {{.Values.jobSchedule | quote }}
  13. concurrencyPolicy: Forbid
  14. successfulJobsHistoryLimit: 3
  15. failedJobsHistoryLimit: 1
  16. jobTemplate:
  17. spec:
  18. backoffLimit: {{ .Values.backoffLimit }}
  19. template:
  20. metadata:
  21. {{- with .Values.podAnnotations }}
  22. annotations:
  23. {{- toYaml . | nindent 12 }}
  24. {{- end }}
  25. labels:
  26. {{- range $key, $value := .Values.podLabels }}
  27. {{ $key }}: "{{ $value }}"
  28. {{- end }}
  29. spec:
  30. {{- if .Values.serviceAccountName }}
  31. serviceAccountName: {{ .Values.serviceAccountName }}
  32. {{- /* explicitly mount token because some service accounts disable automount-by-default and require explicit opt-in */}}
  33. automountServiceAccountToken: true
  34. {{- end }}
  35. restartPolicy: Never
  36. shareProcessNamespace: {{ .Values.shareProcessNamespace }}
  37. containers:
  38. - name: graph-backup
  39. image: {{ .Values.image }}:{{ .Values.imageTag }}
  40. imagePullPolicy: Always
  41. env:
  42. - name: NEO4J_ADDR
  43. value: {{ .Values.neo4jaddr }}
  44. - name: DATABASE
  45. value: {{ .Values.database }}
  46. - name: CLOUD_PROVIDER
  47. value: {{ .Values.cloudProvider }}
  48. - name: BUCKET
  49. value: {{ .Values.bucket }}
  50. - name: HEAP_SIZE
  51. value: {{ .Values.heapSize }}
  52. - name: PAGE_CACHE
  53. value: {{ .Values.pageCache }}
  54. - name: FALLBACK_TO_FULL
  55. value: "{{ .Values.fallbackToFull }}"
  56. - name: CHECK_CONSISTENCY
  57. value: "{{ .Values.checkConsistency }}"
  58. - name: CHECK_INDEXES
  59. value: "{{ .Values.checkIndexes }}"
  60. - name: CHECK_GRAPH
  61. value: "{{ .Values.checkGraph }}"
  62. - name: CHECK_LABEL_SCAN_STORE
  63. value: "{{ .Values.checkLabelScanStore }}"
  64. - name: CHECK_PROPERTY_OWNERS
  65. value: "{{ .Values.checkPropertyOwners }}"
  66. - name: REMOVE_EXISTING_FILES
  67. value: "{{ .Values.removeExistingFiles }}"
  68. - name: REMOVE_BACKUP_FILES
  69. value: "{{ .Values.removeBackupFiles }}"
  70. volumeMounts:
  71. {{- if .Values.secretName }}
  72. - name: credentials
  73. mountPath: /credentials
  74. readOnly: true
  75. {{- end }}
  76. - name: "backup"
  77. mountPath: "/backups"
  78. {{- if .Values.tempVolumeMount }}{{- if .Values.tempVolumeMount.subPath }}
  79. subPath: "{{ .Values.tempVolumeMount.subPath }}"
  80. {{- end }}{{- end }}
  81. {{- if .Values.sidecarContainers }}
  82. {{ toYaml .Values.sidecarContainers | indent 12 }}
  83. {{- end }}
  84. volumes:
  85. {{- if .Values.secretName }}
  86. - name: credentials
  87. secret:
  88. secretName: "{{ .Values.secretName }}"
  89. items:
  90. - key: credentials
  91. path: credentials
  92. {{- end }}
  93. - name: "backup"
  94. {{- with .Values.tempVolume.emptyDir }}
  95. {{- toYaml . | nindent 14 }}
  96. {{- end }}