diff --git a/changelogs/unreleased/8581-kaovilai b/changelogs/unreleased/8581-kaovilai new file mode 100644 index 0000000000..39359b295a --- /dev/null +++ b/changelogs/unreleased/8581-kaovilai @@ -0,0 +1 @@ +Configurable Kopia Maintenance Interval. repo-maintenance-job-configmap adds an option for `fullMaintenanceInterval` where fastGC (12 hours), and eagerGC (6 hours). diff --git a/pkg/repository/udmrepo/kopialib/lib_repo.go b/pkg/repository/udmrepo/kopialib/lib_repo.go index d4e1f88133..1e1225b672 100644 --- a/pkg/repository/udmrepo/kopialib/lib_repo.go +++ b/pkg/repository/udmrepo/kopialib/lib_repo.go @@ -600,6 +600,19 @@ func writeInitParameters(ctx context.Context, repoOption udmrepo.RepoOptions, lo logger.Infof("Quick maintenance interval change from %v to %v", p.QuickCycle.Interval, overwriteQuickMaintainInterval) p.QuickCycle.Interval = overwriteQuickMaintainInterval } + fullMaintIntervalOption := udmrepo.FullMaintenanceIntervalOptions(repoOption.StorageOptions[udmrepo.StoreOptionKeyFullMaintenanceInterval]) + if fullMaintIntervalOption == udmrepo.FastGC { + logger.Infof("Full maintenance interval change from %v to %v", p.FullCycle.Interval, udmrepo.FastGCInterval) + p.FullCycle.Interval = udmrepo.FastGCInterval + } + if fullMaintIntervalOption == udmrepo.EagerGC { + logger.Infof("Full maintenance interval change from %v to %v", p.FullCycle.Interval, udmrepo.EagerGCInterval) + p.FullCycle.Interval = udmrepo.EagerGCInterval + } + if fullMaintIntervalOption == udmrepo.NormalGC { + logger.Infof("Full maintenance interval change from %v to %v", p.FullCycle.Interval, udmrepo.NormalGCInterval) + p.FullCycle.Interval = udmrepo.NormalGCInterval + } p.Owner = r.ClientOptions().UsernameAtHost() diff --git a/pkg/repository/udmrepo/repo_options.go b/pkg/repository/udmrepo/repo_options.go index 28eadfdb9b..94d1c6773b 100644 --- a/pkg/repository/udmrepo/repo_options.go +++ b/pkg/repository/udmrepo/repo_options.go @@ -20,6 +20,7 @@ import ( "os" "path/filepath" "strings" + "time" ) const ( @@ -70,8 +71,19 @@ const ( ThrottleOptionListOps = "listOPS" ThrottleOptionUploadBytes = "uploadBytes" ThrottleOptionDownloadBytes = "downloadBytes" + // FullMaintenanceInterval will overwrite kopia maintenance interval + // options are fastGC for 12 hours, eagerGC for 6 hours + StoreOptionKeyFullMaintenanceInterval = "fullMaintenanceInterval" + FastGC FullMaintenanceIntervalOptions = "fastGC" + FastGCInterval time.Duration = 12 * time.Hour + EagerGC FullMaintenanceIntervalOptions = "eagerGC" + EagerGCInterval time.Duration = 6 * time.Hour + NormalGC FullMaintenanceIntervalOptions = "normalGC" + NormalGCInterval time.Duration = 24 * time.Hour ) +type FullMaintenanceIntervalOptions string + const ( defaultUsername = "default" defaultDomain = "default" diff --git a/site/content/docs/main/repository-maintenance.md b/site/content/docs/main/repository-maintenance.md index 8c712a9d7c..ab39ebd273 100644 --- a/site/content/docs/main/repository-maintenance.md +++ b/site/content/docs/main/repository-maintenance.md @@ -130,8 +130,32 @@ velero install --default-repo-maintain-frequency ``` For Kopia the default maintenance frequency is 1 hour, and Restic is 7 * 24 hours. +### Full Maintenance Interval customization +The full maintenance interval defaults to kopia defaults of 24 hours. Velero provide three override options under `fullMaintenanceInterval` configuration using `backup-repository-configmap` ConfigMap provided to velero install commands. +- normalGC: 24 hours +- fastGC: 12 hours +- eagerGC: 6 hours + +Example of the `backup-repository-configmap` ConfigMap for the above scenario is as below: +```yaml +apiVersion: v1 +kind: ConfigMap +metadata: + name: + namespace: velero +data: + : | + { + "fullMaintenanceInterval": fastGC + } + : | + { + "fullMaintenanceInterval": normalGC + } +``` + ### Others Maintenance jobs will inherit the labels, annotations, toleration, nodeSelector, service account, image, environment variables, cloud-credentials etc. from Velero deployment. [1]: velero-install.md#usage -[2]: node-agent-concurrency.md \ No newline at end of file +[2]: node-agent-concurrency.md