Skip to content

Commit

Permalink
fix: Fixed neo4j backup values (#3)
Browse files Browse the repository at this point in the history
* fix: Fixed neo4j backup values

* fix: Fixed spacing in helm template
  • Loading branch information
shubham030 authored Apr 10, 2023
1 parent 0419099 commit eb5b663
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 28 deletions.
2 changes: 1 addition & 1 deletion charts/neo4j-backup/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@ apiVersion: v2
name: neo4j-backup
description: Backup Neo4J databases to GCS
type: application
version: 0.1.2
version: 0.1.3
appVersion: "1.0.0"
22 changes: 11 additions & 11 deletions charts/neo4j-backup/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ kind: CronJob
metadata:
name: {{ .Release.Name }}-neo4j-backup
spec:
schedule: {{ default "0 3 * * *" .Values.backup.schedule }}
schedule: {{ default "0 3 * * *" .Values.schedule }}
jobTemplate:
spec:
template:
Expand All @@ -16,16 +16,16 @@ spec:
- "-c"
- |
set -e
if [ ! -d "/mnt/backups/{{ required "Name must provided" .Values.backup.name }}" ]; then
mkdir /mnt/backups/{{.Values.backup.name}}
if [ ! -d "/mnt/backups/{{ required "Name must provided" .Values.name }}" ]; then
mkdir /mnt/backups/{{ .Values.name }}
fi
old_IFS=$IFS
IFS=','
db_names="{{- join "," .Values.backup.databases }}"
db_names="{{ - join "," .Values.databases }}"
for db in $db_names; do
neo4j-admin database backup \
--from={{ required "Backup service must be provided" .Values.backup.service }} \
--to-path=/mnt/backups/{{.Values.backup.name}} \
--from={{ required "Backup service must be provided" .Values.service }} \
--to-path=/mnt/backups/{{ .Values.name }} \
--verbose $db
done
IFS=$old_IFS
Expand All @@ -35,17 +35,17 @@ spec:
readOnly: false
resources:
limits:
cpu: {{ default "200m" .Values.backup.resources.cpu }}
memory: {{ default "800Mi" .Values.backup.resources.memory }}
cpu: {{ default "200m" .Values.resources.cpu }}
memory: {{ default "800Mi" .Values.resources.memory }}
containers:
- name: gcs-fuse
image: shubham030/gcs-fuse
command:
- "/bin/sh"
- "-c"
- |
echo {{ required "Service Account is required" .Values.backup.serviceAccount }} | base64 -d > /etc/gcloud/service-account.json
gcsfuse {{ required "Bucket name must be provided" .Values.backup.bucket }} /mnt/gcs
echo {{ required "Service Account is required" .Values.serviceAccount }} | base64 -d > /etc/gcloud/service-account.json
gcsfuse {{ required "Bucket name must be provided" .Values.bucket }} /mnt/gcs
mv /mnt/backups/* /mnt/gcs/
volumeMounts:
- name: gcs-creds-volume
Expand All @@ -56,7 +56,7 @@ spec:
mountPath: /mnt/backups
securityContext:
privileged: true
restartPolicy: {{ default "OnFailure" .Values.backup.restartPolicy }}
restartPolicy: {{ default "OnFailure" .Values.restartPolicy }}
volumes:
- name: shared-volume
emptyDir: {}
Expand Down
31 changes: 15 additions & 16 deletions charts/neo4j-backup/values.yaml
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
backup:
# The name of the GCS bucket where the backups will be stored.
bucket: "test"
# The path where the backups will be stored within the given bucket.
name: ""
# The address of the Kubernetes service where the backup is being taken from.
service: "cluster-name"
# A list of databases that need to be backed up.
databases: # The amount of memory and CPU to use for the backup job.
resources:
cpu: ""
memory: ""
# The restart policy for the backup job.
restartPolicy: ""
# Google serviceAccount with read and write access to the bucket.
serviceAccount: ""
# The name of the GCS bucket where the backups will be stored.
bucket: "test"
# The path where the backups will be stored within the given bucket.
name: ""
# The address of the Kubernetes service where the backup is being taken from.
service: "cluster-name"
# A list of databases that need to be backed up.
databases: # The amount of memory and CPU to use for the backup job.
resources:
cpu: ""
memory: ""
# The restart policy for the backup job.
restartPolicy: ""
# Google serviceAccount with read and write access to the bucket.
serviceAccount: ""

0 comments on commit eb5b663

Please sign in to comment.