feat(flytestdlib): add namespaceutils package to v2#7312
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Ports the flytestdlib/namespaceutils helper package into the v2 module path to unblock downstream services migrating off the v1 flytestdlib/namespaceutils dependency.
Changes:
- Added
GetNamespaceName(template, org, project, domain string) stringfor template-based Kubernetes namespace construction. - Added
GetNameWithNamespacedPrefix(prefix, name string) stringfor prefix/name concatenation. - Ported unit tests for the new package.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| flytestdlib/namespaceutils/namespaceutils.go | Adds the v2 namespaceutils implementation (namespace templating + prefix join helper). |
| flytestdlib/namespaceutils/namespaceutils_test.go | Adds table-driven unit tests covering the new helpers. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Contributor
|
should you switch from merging into v2 to merging into main? I think the flyte2 submodule tracks main now. |
- port GetNamespaceName and GetNameWithNamespacedPrefix utility functions from v1 - enables downstream services to migrate from v1 to v2 flytestdlib - GetNamespaceName generates namespace names using org/project/domain placeholders - GetNameWithNamespacedPrefix concatenates strings with namespace prefix Signed-off-by: Sergey Vilgelm <sergey@union.ai>
5c133aa to
c9b8ee6
Compare
Contributor
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Use strings.NewReplacer for template substitution, simplify prefix
concatenation, and exercise the {{ org }} placeholder in tests.
Assisted-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Signed-off-by: Sergey Vilgelm <sergey@union.ai>
afbrock
approved these changes
May 4, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why are the changes needed?
The
namespaceutilspackage exists in v1flytestdlibbut is missing from v2. Downstream services that depend on v1flytestdlib/namespaceutilscannot migrate to v2 without re-implementing or vendoring these utilities. This PR ports the package to v2 to enable a clean migration path.What changes were proposed in this pull request?
Adds
flytestdlib/namespaceutils/to v2 with the same two functions as the v1 implementation:GetNamespaceName(template, org, project, domain string) string— builds a Kubernetes namespace name by substituting `{{ org }}`, `{{ project }}`, `{{ domain }}` placeholders in a templateGetNameWithNamespacedPrefix(prefix, name string) string— concatenates a prefix and a nameThe implementation is identical to the v1 package — just ported to the v2 module path.
How was this patch tested?
The unit tests from v1 were ported alongside the source. Both functions are covered by table-driven tests:
```
$ go test ./flytestdlib/namespaceutils/
ok github.com/flyteorg/flyte/v2/flytestdlib/namespaceutils 0.300s
```
Labels
Check all the applicable boxes