Skip to content
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

Configurable Kopia Maintenance Interval #8581

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
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 changelogs/unreleased/8581-kaovilai
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Configurable Kopia Maintenance Interval. repo-maintenance-job-configmap adds an option for `fullMaintenanceInterval` where fastGC (12 hours), and eagerGC (6 hours).
13 changes: 13 additions & 0 deletions pkg/repository/udmrepo/kopialib/lib_repo.go
Original file line number Diff line number Diff line change
Expand Up @@ -600,6 +600,19 @@
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
}

Check warning on line 607 in pkg/repository/udmrepo/kopialib/lib_repo.go

View check run for this annotation

Codecov / codecov/patch

pkg/repository/udmrepo/kopialib/lib_repo.go#L605-L607

Added lines #L605 - L607 were not covered by tests
if fullMaintIntervalOption == udmrepo.EagerGC {
logger.Infof("Full maintenance interval change from %v to %v", p.FullCycle.Interval, udmrepo.EagerGCInterval)
p.FullCycle.Interval = udmrepo.EagerGCInterval
}

Check warning on line 611 in pkg/repository/udmrepo/kopialib/lib_repo.go

View check run for this annotation

Codecov / codecov/patch

pkg/repository/udmrepo/kopialib/lib_repo.go#L609-L611

Added lines #L609 - L611 were not covered by tests
if fullMaintIntervalOption == udmrepo.NormalGC {
logger.Infof("Full maintenance interval change from %v to %v", p.FullCycle.Interval, udmrepo.NormalGCInterval)
p.FullCycle.Interval = udmrepo.NormalGCInterval
}

Check warning on line 615 in pkg/repository/udmrepo/kopialib/lib_repo.go

View check run for this annotation

Codecov / codecov/patch

pkg/repository/udmrepo/kopialib/lib_repo.go#L613-L615

Added lines #L613 - L615 were not covered by tests

p.Owner = r.ClientOptions().UsernameAtHost()

Expand Down
12 changes: 12 additions & 0 deletions pkg/repository/udmrepo/repo_options.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import (
"os"
"path/filepath"
"strings"
"time"
)

const (
Expand Down Expand Up @@ -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"
Expand Down
26 changes: 25 additions & 1 deletion site/content/docs/main/repository-maintenance.md
Original file line number Diff line number Diff line change
Expand Up @@ -130,8 +130,32 @@ velero install --default-repo-maintain-frequency <DURATION>
```
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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

does it makes sense to have defaultGC ? I know it's when there are no configuration added, but for usability maybe it makes sense to allow user ensure default is used.

on the second end of the intervals there may be a need to push default to something longer, for the datasets with minimal changes to save on compute costs ?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should have default as an explicit option -- it will make changes from eager/fast back to default consistent with the other changes, and it also keeps Velero consistent with 24 hour default even if Kopia changes their default i the future.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So add default and also infrequentGC ?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know that we need infrequentGC now -- but we could add it in the future if we get a customer complaining that they don't want to remove deleted blobs within 48 hours.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For the name of the default option, I suggest we use normalGC. infrequentGC sounds more like a value below normal.

- eagerGC: 6 hours

Example of the `backup-repository-configmap` ConfigMap for the above scenario is as below:
```yaml
apiVersion: v1
kind: ConfigMap
metadata:
name: <config-name>
namespace: velero
data:
<repository-type-1>: |
{
"fullMaintenanceInterval": fastGC
}
<repository-type-2>: |
{
"fullMaintenanceInterval": normalGC
}
Comment on lines +141 to +154
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pulled this from design, since velero.io docs lack this example still.

```

### 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
[2]: node-agent-concurrency.md
Loading