Skip to content

feat(flytestdlib): add namespaceutils package to v2#7312

Merged
SVilgelm merged 2 commits intomainfrom
svilgelm/add-namespaceutils-v2
May 4, 2026
Merged

feat(flytestdlib): add namespaceutils package to v2#7312
SVilgelm merged 2 commits intomainfrom
svilgelm/add-namespaceutils-v2

Conversation

@SVilgelm
Copy link
Copy Markdown
Contributor

@SVilgelm SVilgelm commented Apr 29, 2026

Why are the changes needed?

The namespaceutils package exists in v1 flytestdlib but is missing from v2. Downstream services that depend on v1 flytestdlib/namespaceutils cannot 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 template
  • GetNameWithNamespacedPrefix(prefix, name string) string — concatenates a prefix and a name

The 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:

  • `TestGetNamespaceName`
  • `TestGetNameWithNamespacedPrefix`

```
$ go test ./flytestdlib/namespaceutils/
ok github.com/flyteorg/flyte/v2/flytestdlib/namespaceutils 0.300s
```

Labels

  • added: new package in v2 flytestdlib

Check all the applicable boxes

  • All new and existing tests passed.
  • All commits are signed-off.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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) string for template-based Kubernetes namespace construction.
  • Added GetNameWithNamespacedPrefix(prefix, name string) string for 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.

Comment thread flytestdlib/namespaceutils/namespaceutils_test.go Outdated
Comment thread flytestdlib/namespaceutils/namespaceutils.go Outdated
Comment thread flytestdlib/namespaceutils/namespaceutils.go Outdated
@afbrock
Copy link
Copy Markdown
Contributor

afbrock commented May 4, 2026

should you switch from merging into v2 to merging into main? I think the flyte2 submodule tracks main now.

@SVilgelm SVilgelm changed the base branch from v2 to main May 4, 2026 19:33
@github-actions github-actions Bot added the flyte2 label May 4, 2026
- 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>
Copilot AI review requested due to automatic review settings May 4, 2026 19:40
@SVilgelm SVilgelm force-pushed the svilgelm/add-namespaceutils-v2 branch from 5c133aa to c9b8ee6 Compare May 4, 2026 19:40
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread flytestdlib/namespaceutils/namespaceutils_test.go Outdated
Comment thread flytestdlib/namespaceutils/namespaceutils.go
Comment thread flytestdlib/namespaceutils/namespaceutils.go Outdated
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>
@SVilgelm SVilgelm merged commit 719ea1c into main May 4, 2026
21 checks passed
@SVilgelm SVilgelm deleted the svilgelm/add-namespaceutils-v2 branch May 4, 2026 20:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants