allow custom restic repo prefix to be specified in BSL config

Signed-off-by: Steve Kriss <krisss@vmware.com>
This commit is contained in:
Steve Kriss
2019-08-08 15:07:21 -06:00
parent 8b6c505817
commit 32d46871cc
2 changed files with 5 additions and 1 deletions

View File

@@ -57,6 +57,10 @@ func getRepoPrefix(location *velerov1api.BackupStorageLocation) (string, error)
provider = "velero.io/" + provider
}
if repoPrefix := location.Spec.Config["resticRepoPrefix"]; repoPrefix != "" {
return repoPrefix, nil
}
switch BackendType(provider) {
case AWSBackend:
var url string

View File

@@ -158,7 +158,7 @@ func TestGetRepoIdentifier(t *testing.T) {
},
}
id, err = GetRepoIdentifier(backupLocation, "repo-1")
assert.EqualError(t, err, "cannot determine restic repository prefix for backup storage location")
assert.EqualError(t, err, "restic repository prefix (resticRepoPrefix) not specified in backup storage location's config")
assert.Empty(t, id)
backupLocation = &velerov1api.BackupStorageLocation{