-
Notifications
You must be signed in to change notification settings - Fork 44
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
Fix listing all namespaces when base URL is specified #424
Conversation
@@ -130,7 +131,7 @@ def _construct_url( | |||
parts = [base] | |||
if version: | |||
parts.append(version) | |||
if namespace is not None: | |||
if namespace: |
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.
When using a URL with a base url component and setting namespace=kr8s.ALL
this can end up as an empty string. So modifying the if statement to catch that case.
@@ -111,6 +111,7 @@ async def _create_session(self) -> None: | |||
headers=headers, | |||
verify=await self.auth.ssl_context(), | |||
timeout=self._timeout, | |||
follow_redirects=True, |
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.
If a baseurl is set we may get redirected. By default httpx
doesn't follow redirects, but we probably always want to.
dcbb55d
to
75ac962
Compare
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #424 +/- ##
==========================================
+ Coverage 94.61% 95.27% +0.65%
==========================================
Files 29 30 +1
Lines 3141 3661 +520
==========================================
+ Hits 2972 3488 +516
- Misses 169 173 +4 ☔ View full report in Codecov by Sentry. |
Fixes the issues covered in #284. When specifying the baseurl of a server there seems to be a couple of problems with constructing the API urls.
I also noticed that when setting
kr8s.api(url="...")
the load kubeconfig code is never called, so the default namespace is never loaded. I added a quick workaround for this so that we get the default namespace, but I'm not sure if this is correct behaviour. I'll open a new issue to explore this further.