-
Notifications
You must be signed in to change notification settings - Fork 219
fix: NPE when no namespace is provided in kube config #899
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
Conversation
SonarCloud Quality Gate failed. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
@@ -67,7 +68,12 @@ static boolean currentNamespaceWatched(Set<String> namespaces) { | |||
throw new IllegalStateException( | |||
"Parent ConfigurationService must be set before calling this method"); | |||
} | |||
targetNamespaces = Collections.singleton(parent.getClientConfiguration().getNamespace()); | |||
String namespace = parent.getClientConfiguration().getNamespace(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure about this change, is possibly going to break user's (especially CIs) environment when a provider doesn't set the default namespace.
I would suggest that if the namespace is null
you can output a warning message and automatically set it to default
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Btw not sure if this can happen in a real environment (I mean pod), probably just locally, for that purpose might be better to have an exception, so developer won't search for the problem unnecessarily.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A possibility, for the deployment, is to use a downwardAPI.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I mean, a default namespace will be always there.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, this should only happen when outside of the cluster…
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not sure if this can happen in a real environment
I'm mostly worried about CI ... but, well, an additional command doesn't hurt as well 🤷
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's see how it goes and maybe revisit if needed?
Fixes #897