Skip to content

Commit

Permalink
change delimiter in prefix to /
Browse files Browse the repository at this point in the history
  • Loading branch information
shubham-pampattiwar committed Feb 6, 2025
1 parent 028f259 commit 9bc63bc
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions internal/common/function/function.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 "<namespace>-<customPrefix>".
// If a custom prefix is provided, it returns "<namespace>/<customPrefix>".
// 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
}
Original file line number Diff line number Diff line change
Expand Up @@ -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 <non-admin-ns>-foo
// 2. TODO use the value from enforced spec if specified by the admin, if specified as "bar" then prefix used would be <non-admin-ns>-bar
// 1. Check if user has specified the prefix as "foo" in NaBSL creation, then prefix used would be <non-admin-ns>/foo
// 2. TODO use the value from enforced spec if specified by the admin, if specified as "bar" then prefix used would be <non-admin-ns>/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)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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",
}),
)
})

0 comments on commit 9bc63bc

Please sign in to comment.