Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions contrib/charts/dragonfly/templates/_pod.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Copy link
Contributor

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=false is the correct flag to have rdb format?

Copy link
Collaborator

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? :)

{{- end }}
{{- end }}
{{- with .Values.extraArgs }}
{{- toYaml . | trim | nindent 6 }}
{{- end }}
Expand Down Expand Up @@ -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" }}
Copy link
Contributor

Choose a reason for hiding this comment

The 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
Copy link
Contributor

Choose a reason for hiding this comment

The 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:
Expand Down
26 changes: 26 additions & 0 deletions contrib/charts/dragonfly/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,32 @@ storage:
# -- Volume size to request for the PVC
requests: 128Mi

snapshot:
# -- enable snapshot
enabled: false
# -- snapshot cron schedule format (crontab style)
schedule: ""
# -- snapshot format (default: "df" for Dragonfly, "rdb" is also supported)
format: "df"
# -- snapshot cleaner
cleaner:
# -- snapshot cleaner image
image: "alpine:3.22"
# -- snapshot cleaner interval
interval: 30m
# -- max snapshots to keep (default: 10)
max_count: 10
# -- snapshot cleaner resources
resources:
# -- The requested resources for the cleaner container
requests: {}
# cpu: 50m
# memory: 128Mi
# -- The resource limits for the cleaner container
limits: {}
# cpu: 50m
# memory: 128Mi

tls:
# -- enable TLS
enabled: false
Expand Down
Loading