Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[DPE-3247] Add creation of non-existing namespace #96

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

welpaolo
Copy link
Contributor

@welpaolo welpaolo commented May 14, 2024

This PR adds the capability of the spark8t lib to create the namespace if it does not exist.

logger.warn(
f"Namespace {namespace} does not exist, and it could not be created."
)
raise NamespaceNotFound(namespace)
Copy link
Member

Choose a reason for hiding this comment

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

nit: In my opinion this class name doesn't truly describe that the namespace could not be created (which is the case because Exception catches everything that is thrown during the creation of namespace).

logger.warn(
f"Namespace {namespace} does not exist, and it could not be created."
)
raise NamespaceNotFound(namespace)
Copy link
Member

Choose a reason for hiding this comment

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

Also I believe we haven't caught NamespaceNotFound yet in main. Therefore, the raise here will possibly pass through the except Exception block in main from where it will be raised again.

Copy link
Member

Choose a reason for hiding this comment

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

On this regard, it'd be awesome if we could add an integration test for this scenario (where the SA that is creating the namespace doesn't have enough permissions). However I'm not sure if there's a way to do that without involving pods and all complexities.

spark8t/exceptions.py Show resolved Hide resolved
Copy link
Contributor

@deusebio deusebio left a comment

Choose a reason for hiding this comment

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

I agree with the point raised by @theoctober19th . It would be good to have the restricted permission tests, to make sure we have proper error handling

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.

None yet

3 participants