Skip to content

Commit

Permalink
fix: using find instead of ls to cleanup old backups (fixes #31) (#32)
Browse files Browse the repository at this point in the history
* fix: using find instead of ls to cleanup old backups (fixes #31)

Tests: `helm template .` looks good

* fix: updating versions (following @edevosc2c's feedback)

* feat: backup-ldap - retention set to 30 days

sounds more reasonable in case of issues, than 10 days.
  • Loading branch information
pmauduit authored Jan 22, 2025
1 parent 8cb02ef commit 87f85d3
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions georchestra-backup-ldap/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ type: application
# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/)
version: 1.1.0
version: 2.0.0

# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application. Versions are not expected to
# follow Semantic Versioning. They should reflect the version the application is using.
# It is recommended to use it with quotes.
appVersion: "1.0.0"
appVersion: "2.0.0"
4 changes: 2 additions & 2 deletions georchestra-backup-ldap/templates/cronjob.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ spec:
/usr/bin/ldapsearch -H {{ $ldapTargetConfiguration.service }} -xLLL -D "{{ $ldapTargetConfiguration.adminDn }}" -w {{ $ldapTargetConfiguration.secret }} -b "{{ $ldapTargetConfiguration.orgsRdn }},{{ $ldapTargetConfiguration.baseDn }}" >> /backup/ldap-$(date +"%s").ldif;
/usr/bin/ldapsearch -H {{ $ldapTargetConfiguration.service }} -xLLL -D "{{ $ldapTargetConfiguration.adminDn }}" -w {{ $ldapTargetConfiguration.secret }} -b "{{ $ldapTargetConfiguration.pendingorgsRdn }},{{ $ldapTargetConfiguration.baseDn }}" >> /backup/ldap-$(date +"%s").ldif;
/usr/bin/ldapsearch -H {{ $ldapTargetConfiguration.service }} -xLLL -D "{{ $ldapTargetConfiguration.adminDn }}" -w {{ $ldapTargetConfiguration.secret }} -b "{{ $ldapTargetConfiguration.rolesRdn }},{{ $ldapTargetConfiguration.baseDn }}" >> /backup/ldap-$(date +"%s").ldif;
cd /backup && rm `ls -t | awk 'NR>{{ .Values.configuration.keepLastBackups }}'`
find /backup -name '*.ldif' -mtime +{{.Values.configuration.backupRetentionDays}} -delete ;
{{- with $job.resources }}
resources:
{{ toYaml . | nindent 12 }}
Expand All @@ -65,4 +65,4 @@ spec:
{{- with $job.tolerations }}
tolerations:
{{ toYaml . | nindent 10 }}
{{- end }}
{{- end }}
4 changes: 2 additions & 2 deletions georchestra-backup-ldap/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ job:
imagePullSecrets: []

configuration:
keepLastBackups: "10"
backupRetentionDays: "30"
ldapTarget:
# the url to the ldap kubernetes service
service: "ldap://georchestra-ldap-svc:389"
Expand Down Expand Up @@ -74,4 +74,4 @@ persistence:
size: 5Gi
## Use an existing PV
##
# existingPV:
# existingPV:

0 comments on commit 87f85d3

Please sign in to comment.