-
Notifications
You must be signed in to change notification settings - Fork 1.1k
feat(helm): add snapshot functionality with automatic cleanup #5892
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -83,6 +83,13 @@ containers: | |
| {{- end }} | ||
| args: | ||
| - "--alsologtostderr" | ||
| {{- if .Values.snapshot.enabled }} | ||
| - "--snapshot_cron" | ||
| - "{{ .Values.snapshot.schedule }}" | ||
| {{- if eq .Values.snapshot.format "rdb" }} | ||
| - "--nodf_snapshot_format" | ||
| {{- end }} | ||
| {{- end }} | ||
| {{- with .Values.extraArgs }} | ||
| {{- toYaml . | trim | nindent 6 }} | ||
| {{- end }} | ||
|
|
@@ -123,6 +130,31 @@ containers: | |
| envFrom: | ||
| {{- toYaml . | trim | nindent 6 }} | ||
| {{- end }} | ||
| {{- if .Values.snapshot.enabled }} | ||
| - name: snapshot-cleaner | ||
| image: {{ .Values.snapshot.cleaner.image }} | ||
| command: | ||
| - /bin/sh | ||
| - -c | ||
| - | | ||
| while true; do | ||
| {{- if eq .Values.snapshot.format "dragonfly" }} | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. should be "df" instead of "dragonfly" as you are keeping only two formats "df" and "rdb" from the comment below. |
||
| # Keep only the last {{ .Values.snapshot.cleaner.max_count }} snapshots (composed of two files each) | ||
| ls -1t /data/dump-*.dfs | tail -n +{{ add 1 (mul .Values.snapshot.cleaner.max_count 2) }} | xargs rm -f | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. have you tested provisioning this container locally? Just want to be sure this script works. |
||
| {{- else }} | ||
| # Keep only the last {{ .Values.snapshot.cleaner.max_count }} snapshots | ||
| ls -1t /data/dump-*.rdb | tail -n +{{ add 1 .Values.snapshot.cleaner.max_count }} | xargs rm -f | ||
| {{- end }} | ||
| sleep {{ .Values.snapshot.cleaner.interval }} | ||
| done | ||
| volumeMounts: | ||
| - mountPath: /data | ||
| name: "{{ .Release.Name }}-data" | ||
| {{- with .Values.snapshot.cleaner.resources }} | ||
| resources: | ||
| {{- toYaml . | trim | nindent 6 }} | ||
| {{- end }} | ||
| {{- end }} | ||
|
|
||
| {{- if or (.Values.tls.enabled) (.Values.extraVolumes) }} | ||
| volumes: | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@romange do we have this flag? I think
--df_snapshot_format=falseis the correct flag to have rdb format?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it's equivalent, though I am surprised that people know this notion as it is a special format for boolean flags in google flags library :) @renan how did you know? :)