diff --git a/internal/common/function/function.go b/internal/common/function/function.go index 39257bc..760406e 100644 --- a/internal/common/function/function.go +++ b/internal/common/function/function.go @@ -634,11 +634,11 @@ func GetLogger(ctx context.Context, obj client.Object, key string) logr.Logger { } // ComputePrefixForObjectStorage returns the prefix to be used for the BackupStorageLocation. -// If a custom prefix is provided, it returns "-". +// If a custom prefix is provided, it returns "/". // Otherwise, it returns the namespace name. func ComputePrefixForObjectStorage(namespace, customPrefix string) string { if len(customPrefix) > 0 { - return fmt.Sprintf("%s-%s", namespace, customPrefix) + return fmt.Sprintf("%s/%s", namespace, customPrefix) } return namespace } diff --git a/internal/controller/nonadminbackupstoragelocation_controller.go b/internal/controller/nonadminbackupstoragelocation_controller.go index 49123c4..da96c94 100644 --- a/internal/controller/nonadminbackupstoragelocation_controller.go +++ b/internal/controller/nonadminbackupstoragelocation_controller.go @@ -541,8 +541,8 @@ func (r *NonAdminBackupStorageLocationReconciler) createVeleroBSL(ctx context.Co } // NaBSL/BSL must have a unique prefix for proper function of the non-admin backup sync controller - // 1. Check if user has specified the prefix as "foo" in NaBSL creation, then prefix used would be -foo - // 2. TODO use the value from enforced spec if specified by the admin, if specified as "bar" then prefix used would be -bar + // 1. Check if user has specified the prefix as "foo" in NaBSL creation, then prefix used would be /foo + // 2. TODO use the value from enforced spec if specified by the admin, if specified as "bar" then prefix used would be /bar // 3. If none of the above, then we will use the non-admin user's namespace name as prefix prefix := function.ComputePrefixForObjectStorage(nabsl.Namespace, nabsl.Spec.BackupStorageLocationSpec.ObjectStorage.Prefix) diff --git a/internal/controller/nonadminbackupstoragelocation_controller_test.go b/internal/controller/nonadminbackupstoragelocation_controller_test.go index eeadf5f..49c879d 100644 --- a/internal/controller/nonadminbackupstoragelocation_controller_test.go +++ b/internal/controller/nonadminbackupstoragelocation_controller_test.go @@ -486,7 +486,7 @@ var _ = ginkgo.Describe("ComputePrefixForObjectStorage", func() { ginkgo.Entry("with custom prefix", prefixTestScenario{ namespace: "test-nac-ns", customPrefix: "foo", - expectedPrefix: "test-nac-ns-foo", + expectedPrefix: "test-nac-ns/foo", }), ) })