Skip to content
Merged
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
1 change: 1 addition & 0 deletions cmd/operator/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ var (
&cli.StringFlag{Destination: &cfg.Config.BackupAnnotation, Name: "annotation", EnvVars: []string{"BACKUP_ANNOTATION"}, Value: "k8up.io/backup", Usage: "the annotation to be used for filtering"},
&cli.StringFlag{Destination: &cfg.Config.BackupCommandAnnotation, Name: "backupcommandannotation", EnvVars: []string{"BACKUP_BACKUPCOMMANDANNOTATION"}, Value: "k8up.io/backupcommand", Usage: "set the annotation name that identify the backup commands on Pods"},
&cli.StringFlag{Destination: &cfg.Config.FileExtensionAnnotation, Name: "fileextensionannotation", EnvVars: []string{"BACKUP_FILEEXTENSIONANNOTATION"}, Value: "k8up.io/file-extension", Usage: "set the annotation name where the file extension is stored for backup commands"},
&cli.StringFlag{Destination: &cfg.Config.BackupResticArgsAnnotation, Name: "backupresticargsannotation", EnvVars: []string{"BACKUP_RESTICARGSANNOTATION"}, Value: "k8up.io/backup-restic-args", Usage: "set the annotation name to be used to modify restic wrapper call args on backup (e.g. to add excludes)"},

&cli.IntFlag{Destination: &cfg.Config.GlobalKeepJobs, Hidden: true, Name: "globalkeepjobs", EnvVars: []string{"BACKUP_GLOBALKEEPJOBS"}, Value: -1, DefaultText: "unlimited", Usage: "set the number of old jobs to keep when cleaning up, applies to all job types"},
&cli.IntFlag{Destination: &cfg.Config.GlobalBackoffLimit, Name: "global-backoff-limit", EnvVars: []string{"BACKUP_GLOBAL_BACKOFF_LIMIT"}, Value: 6, Usage: "set the backoff limit for all backup jobs"},
Expand Down
21 changes: 21 additions & 0 deletions cmd/restic/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,18 @@ var (
&cli.StringFlag{Destination: &cfg.Config.ResticRepository, Name: "resticRepository", EnvVars: []string{"RESTIC_REPOSITORY"}, Usage: "The restic repository to perform the action with", Required: true},
&cli.StringFlag{Destination: &cfg.Config.ResticOptions, Name: "resticOptions", EnvVars: []string{"RESTIC_OPTIONS"}, Usage: "Additional options to pass to restic in the format 'key=value,key2=value2'"},

&cli.StringSliceFlag{Name: "exclude", EnvVars: []string{"RESTIC_EXCLUDE"}, Usage: "In backup, passed to restic: exclude a `pattern` (can be specified multiple times)"},
&cli.BoolFlag{Destination: &cfg.Config.ExcludeCaches, Name: "excludeCaches", EnvVars: []string{"RESTIC_EXCLUDE_CACHES"}, Usage: "In backup, passed to restic: excludes cache directories that are marked with a CACHEDIR.TAG file. See https://bford.info/cachedir/ for the Cache Directory Tagging Standard"},
&cli.StringSliceFlag{Name: "excludeFile", EnvVars: []string{"RESTIC_EXCLUDE_FILE"}, Usage: "In backup, passed to restic: read exclude patterns from a `file` (can be specified multiple times). This file MUST be available in backup job container (e.g. in the directory being backed up)"},
&cli.StringSliceFlag{Name: "excludeIfPresent", EnvVars: []string{"RESTIC_EXCLUDE_IF_PRESENT"}, Usage: "In backup, passed to restic: takes `filename[:header]`, exclude contents of directories containing filename (except filename itself) if header of that file is as provided (can be specified multiple times)"},
&cli.StringFlag{Destination: &cfg.Config.ExcludeLargerThan, Name: "excludeLargerThan", EnvVars: []string{"RESTIC_EXCLUDE_LARGER_THAT"}, Usage: "In backup, passed to restic: max `size` of the files to be backed up (allowed suffixes: k/K, m/M, g/G, t/T)"},
&cli.StringSliceFlag{Name: "filesFrom", EnvVars: []string{"RESTIC_FILES_FROM"}, Usage: "In backup, passed to restic: read the files to backup from `file` (can be combined with file args; can be specified multiple times)"},
&cli.StringSliceFlag{Name: "filesFromRaw", EnvVars: []string{"RESTIC_FILES_FROM_RAW"}, Usage: "In backup, passed to restic: read the files to backup from `file` (can be combined with file args; can be specified multiple times)"},
&cli.StringSliceFlag{Name: "filesFromVerbatim", EnvVars: []string{"RESTIC_FILES_FROM_VERBATIM"}, Usage: "In backup, passed to restic: read the files to backup from `file` (can be combined with file args; can be specified multiple times)"},
&cli.StringSliceFlag{Name: "iExclude", EnvVars: []string{"RESTIC_IEXCLUDE"}, Usage: "In backup, passed to restic: same as --exclude `pattern` but ignores the casing of filenames"},
&cli.StringSliceFlag{Name: "iExcludeFile", EnvVars: []string{"RESTIC_IEXCLUDE_FILE"}, Usage: "In backup, passed to restic: same as --exclude-file `pattern` but ignores the casing of filenames"},
&cli.BoolFlag{Destination: &cfg.Config.OneFileSystem, Name: "oneFileSystem", EnvVars: []string{"RESTIC_ONE_FILESYSTEM"}, Usage: "In backup, passed to restic: exclude other file systems, don't cross filesystem boundaries and subvolumes"},

&cli.IntFlag{Destination: &cfg.Config.PruneKeepLast, Name: "keepLatest", EnvVars: []string{"KEEP_LAST", "KEEP_LATEST"}, Usage: "While pruning, keep at the latest snapshot"},
&cli.IntFlag{Destination: &cfg.Config.PruneKeepHourly, Name: "keepHourly", EnvVars: []string{"KEEP_HOURLY"}, Usage: "While pruning, keep hourly snapshots"},
&cli.IntFlag{Destination: &cfg.Config.PruneKeepDaily, Name: "keepDaily", EnvVars: []string{"KEEP_DAILY"}, Usage: "While pruning, keep daily snapshots"},
Expand Down Expand Up @@ -112,6 +124,15 @@ func resticMain(c *cli.Context) error {
cfg.Config.Tags = c.StringSlice("tag")
cfg.Config.TargetPods = c.StringSlice("targetPods")

cfg.Config.Exclude = c.StringSlice("exclude")
cfg.Config.ExcludeFile = c.StringSlice("excludeFile")
cfg.Config.ExcludeIfPresent = c.StringSlice("excludeIfPresent")
cfg.Config.FilesFrom = c.StringSlice("filesFrom")
cfg.Config.FilesFromRaw = c.StringSlice("filesFromRaw")
cfg.Config.FilesFromVerbatim = c.StringSlice("filesFromVerbatim")
cfg.Config.IExclude = c.StringSlice("iExclude")
cfg.Config.IExcludeFile = c.StringSlice("iExcludeFile")

err := cfg.Config.Validate()
if err != nil {
return err
Expand Down
1 change: 1 addition & 0 deletions docs/modules/ROOT/examples/usage/operator.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ OPTIONS:
--annotation value the annotation to be used for filtering (default: "k8up.io/backup") [$BACKUP_ANNOTATION]
--backupcommandannotation value set the annotation name that identify the backup commands on Pods (default: "k8up.io/backupcommand") [$BACKUP_BACKUPCOMMANDANNOTATION]
--fileextensionannotation value set the annotation name where the file extension is stored for backup commands (default: "k8up.io/file-extension") [$BACKUP_FILEEXTENSIONANNOTATION]
--backupresticargsannotation value set the annotation name to be used to modify restic wrapper call args on backup (e.g. to add excludes) (default: "k8up.io/backup-restic-args") [$BACKUP_RESTICARGSANNOTATION]
--global-backoff-limit value set the backoff limit for all backup jobs (default: 6) [$BACKUP_GLOBAL_BACKOFF_LIMIT]
--global-failed-jobs-history-limit value set the number of old, failed jobs to keep when cleaning up, applies to all job types (default: 3) [$BACKUP_GLOBAL_FAILED_JOBS_HISTORY_LIMIT]
--global-successful-jobs-history-limit value set the number of old, successful jobs to keep when cleaning up, applies to all job types (default: 3) [$BACKUP_GLOBAL_SUCCESSFUL_JOBS_HISTORY_LIMIT]
Expand Down
Loading