Skip to content

feat: strict NamespacedName handling#160

Merged
choufraise merged 1 commit intomainfrom
refactor/secrets
Mar 13, 2026
Merged

feat: strict NamespacedName handling#160
choufraise merged 1 commit intomainfrom
refactor/secrets

Conversation

@choufraise
Copy link
Collaborator

In nAuth there are several places where we accept an empty namespace and where we then default to e.g. operator-, account- or other CR namespace. This is error-prone due to the risk of passing around "" namespace too deep before it's noticed. Introducing a domain model for dealing with validated Namespace and NamespacedName enabling stricter interfaces and the ability to fail faster with clear expectations.

In nAuth there are several places where we accept an empty namespace and where we then default to e.g. operator-, account- or other CR namespace. This is error-prone due to the risk of passing around "" namespace too deep before it's noticed. Introducing a domain model for dealing with validated Namespace and NamespacedName enabling stricter interfaces and the ability to fail faster with clear expectations.

Signed-off-by: Thobias Karlsson <thobias.karlsson@gmail.com>
@choufraise choufraise requested a review from a team as a code owner March 13, 2026 12:01
Copy link
Contributor

@henriropp henriropp left a comment

Choose a reason for hiding this comment

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

Looks good. Just thinking if the Namespace needs to have a type, is it only used in the main? validate once and done, or do we foresee more Namespace usage, that is not NamespacedName?

@choufraise choufraise merged commit 9d7f31e into main Mar 13, 2026
6 checks passed
@choufraise choufraise deleted the refactor/secrets branch March 13, 2026 13:37
@choufraise
Copy link
Collaborator Author

Looks good. Just thinking if the Namespace needs to have a type, is it only used in the main? validate once and done, or do we foresee more Namespace usage, that is not NamespacedName?

It's not just in main, that would have been overkill I agree. It's also used when searching for secrets by namespace and labels and when looking up clusters.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants