diff --git a/changelogs/unreleased/9351-kvaps b/changelogs/unreleased/9351-kvaps new file mode 100644 index 0000000000..3e8a6fe9db --- /dev/null +++ b/changelogs/unreleased/9351-kvaps @@ -0,0 +1 @@ +Fix: Enable throttling parameters in BackupRepository repositoryConfig diff --git a/pkg/repository/provider/unified_repo.go b/pkg/repository/provider/unified_repo.go index 251845dacb..25532033ec 100644 --- a/pkg/repository/provider/unified_repo.go +++ b/pkg/repository/provider/unified_repo.go @@ -586,6 +586,11 @@ func getStorageVariables(backupLocation *velerov1api.BackupStorageLocation, repo validParams := []string{ udmrepo.StoreOptionCacheLimit, udmrepo.StoreOptionKeyFullMaintenanceInterval, + udmrepo.ThrottleOptionReadOps, + udmrepo.ThrottleOptionWriteOps, + udmrepo.ThrottleOptionListOps, + udmrepo.ThrottleOptionUploadBytes, + udmrepo.ThrottleOptionDownloadBytes, } for _, param := range validParams { if v, found := backupRepoConfig[param]; found { diff --git a/pkg/repository/provider/unified_repo_test.go b/pkg/repository/provider/unified_repo_test.go index 9cd49742c6..c5f67faeb8 100644 --- a/pkg/repository/provider/unified_repo_test.go +++ b/pkg/repository/provider/unified_repo_test.go @@ -460,6 +460,37 @@ func TestGetStorageVariables(t *testing.T) { "cacheLimitMB": "1000", }, }, + { + name: "fs with throttle config", + backupLocation: velerov1api.BackupStorageLocation{ + Spec: velerov1api.BackupStorageLocationSpec{ + Provider: "velero.io/fs", + Config: map[string]string{ + "fspath": "fake-path", + "prefix": "fake-prefix", + }, + }, + }, + repoBackend: "fake-repo-type", + repoConfig: map[string]string{ + udmrepo.ThrottleOptionUploadBytes: "838860800", + udmrepo.ThrottleOptionDownloadBytes: "838860800", + udmrepo.ThrottleOptionReadOps: "100", + udmrepo.ThrottleOptionWriteOps: "100", + udmrepo.ThrottleOptionListOps: "50", + }, + expected: map[string]string{ + "fspath": "fake-path", + "bucket": "", + "prefix": "fake-prefix/fake-repo-type/", + "region": "", + "ThrottleUploadBytes": "838860800", + "ThrottleDownloadBytes": "838860800", + "ThrottleReadOPS": "100", + "ThrottleWriteOPS": "100", + "ThrottleListOPS": "50", + }, + }, } for _, tc := range testCases { diff --git a/pkg/repository/udmrepo/repo_options.go b/pkg/repository/udmrepo/repo_options.go index efddfdcd10..28018cdc61 100644 --- a/pkg/repository/udmrepo/repo_options.go +++ b/pkg/repository/udmrepo/repo_options.go @@ -66,11 +66,11 @@ const ( StoreOptionCacheLimit = "cacheLimitMB" - ThrottleOptionReadOps = "readOPS" - ThrottleOptionWriteOps = "writeOPS" - ThrottleOptionListOps = "listOPS" - ThrottleOptionUploadBytes = "uploadBytes" - ThrottleOptionDownloadBytes = "downloadBytes" + ThrottleOptionReadOps = "ThrottleReadOPS" + ThrottleOptionWriteOps = "ThrottleWriteOPS" + ThrottleOptionListOps = "ThrottleListOPS" + ThrottleOptionUploadBytes = "ThrottleUploadBytes" + ThrottleOptionDownloadBytes = "ThrottleDownloadBytes" // FullMaintenanceInterval will overwrite kopia maintenance interval // options are fastGC for 12 hours, eagerGC for 6 hours, normalGC for 24 hours StoreOptionKeyFullMaintenanceInterval = "fullMaintenanceInterval" diff --git a/site/content/docs/main/backup-repository-configuration.md b/site/content/docs/main/backup-repository-configuration.md index fd6cf0b781..8cfb7eac50 100644 --- a/site/content/docs/main/backup-repository-configuration.md +++ b/site/content/docs/main/backup-repository-configuration.md @@ -31,7 +31,9 @@ data: : | { "cacheLimitMB": 2048, - "fullMaintenanceInterval": "fastGC" + "fullMaintenanceInterval": "fastGC", + "ThrottleUploadBytes": "838860800", + "ThrottleDownloadBytes": "838860800" } : | { @@ -59,5 +61,15 @@ Per kopia [Maintenance Safety](https://kopia.io/docs/advanced/maintenance/#maint On the other hand, the not-in-use data will be deleted permanently after the full maintenance, so shorter full maintenance intervals may weaken the data safety if they are used incorrectly. +`ThrottleUploadBytes`: specifies the maximum upload speed in bytes per second for the repository. This can be used to throttle the upload bandwidth. The value should be specified as a string representing bytes per second (e.g., "838860800" for ~800 MB/s). This parameter applies during repository operations that write data. + +`ThrottleDownloadBytes`: specifies the maximum download speed in bytes per second for the repository. This can be used to throttle the download bandwidth. The value should be specified as a string representing bytes per second (e.g., "838860800" for ~800 MB/s). This parameter applies during repository operations that read data. + +`ThrottleReadOPS`: specifies the maximum number of read operations per second. This can be used to throttle the rate of read operations to the storage backend. + +`ThrottleWriteOPS`: specifies the maximum number of write operations per second. This can be used to throttle the rate of write operations to the storage backend. + +`ThrottleListOPS`: specifies the maximum number of list operations per second. This can be used to throttle the rate of list operations to the storage backend. + [1]: file-system-backup.md [2]: csi-snapshot-data-movement.md