-
Notifications
You must be signed in to change notification settings - Fork 2.5k
chore: update remote provider url for obtaining k8s context by id #15566
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
chore: update remote provider url for obtaining k8s context by id #15566
Conversation
Signed-off-by: Nikita B <n2h9z4@gmail.com>
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.
Summary of Changes
Hello @n2h9, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!
I've implemented a fix to resolve an issue where deleting Kubernetes connections was failing. The problem was identified as an outdated URL used to retrieve Kubernetes contexts from the remote provider. My changes update this URL to the correct endpoint, ensuring that Kubernetes connections can now be successfully deleted. This directly addresses the observed failures when attempting to remove Kubernetes-kind connections.
Highlights
- Kubernetes Connection Deletion Fix: I've addressed an issue preventing the successful deletion of Kubernetes connections. Previously, the system failed to delete connections of
kind = kubernetes
because the URL used to fetch the Kubernetes context was incorrect, leading to deletion failures. - URL Path Update: I've updated the
GetK8sContext
function inserver/models/remote_provider.go
to use the correct URL path/kubernetes/%s/context
instead of/kubernetes/%s
when retrieving the Kubernetes context by connection ID. This change aligns the application with recent API updates on the remote provider side.
Using Gemini Code Assist
The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.
Invoking Gemini
You can request assistance from Gemini at any point in your pull request via creating an issue comment (i.e. comment on the pull request page) using either /gemini <command>
or @gemini-code-assist <command>
. Below is a summary of the supported commands.
Feature | Command | Description |
---|---|---|
Code Review | /gemini review |
Performs a code review for the current pull request in its current state. |
Pull Request Summary | /gemini summary |
Provides a summary of the current pull request in its current state. |
Comment | @gemini-code-assist | Responds in comments when explicitly tagged, both in issue comments and review comments. |
Help | /gemini help |
Displays a list of available commands. |
Customization
To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/
folder in the base of the repository. Detailed instructions can be found here.
Limitations & Feedback
Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments or fill out our survey to provide feedback.
You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.
Footnotes
-
Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution. ↩
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.
Code Review
This pull request updates the URL for fetching a Kubernetes context from a remote provider, fixing a bug where deleting a Kubernetes connection would fail. The change itself is correct and addresses the issue described. My review includes one critical point of feedback regarding error handling on the modified line, which could lead to a panic if not addressed.
@@ -897,7 +897,7 @@ func (l *RemoteProvider) GetK8sContext(token, connectionID string) (K8sContext, | |||
return K8sContext{}, ErrInvalidCapability("PersistConnection", l.ProviderName) | |||
} | |||
ep, _ := l.Capabilities.GetEndpointForFeature(PersistConnection) | |||
remoteProviderURL, _ := url.Parse(fmt.Sprintf("%s%s/kubernetes/%s", l.RemoteProviderURL, ep, connectionID)) | |||
remoteProviderURL, _ := url.Parse(fmt.Sprintf("%s%s/kubernetes/%s/context", l.RemoteProviderURL, ep, connectionID)) |
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.
The error returned by url.Parse
is being ignored. If parsing fails (for example, if l.RemoteProviderURL
is malformed), remoteProviderURL
will be nil
. The subsequent call to remoteProviderURL.String()
on line 902 will then cause a panic due to a nil pointer dereference. It's crucial to handle this potential error.
remoteProviderURL, _ := url.Parse(fmt.Sprintf("%s%s/kubernetes/%s/context", l.RemoteProviderURL, ep, connectionID)) | |
remoteProviderURL, err := url.Parse(fmt.Sprintf("%s%s/kubernetes/%s/context", l.RemoteProviderURL, ep, connectionID)) | |
if err != nil { | |
return K8sContext{}, err | |
} |
|
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #15566 +/- ##
=======================================
Coverage 5.32% 5.32%
=======================================
Files 304 304
Lines 58681 58681
=======================================
Hits 3127 3127
Misses 55214 55214
Partials 340 340
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Commit SHA: END-TO-END TESTS
📦 Test Result Summary
⌛ Duration: 9 minutes and 19 seconds Overall Result: 👎 Some tests failed. [Show/Hide] Test Result Details
|
Notes for Reviewers
Right now when user tried to delete connection which has kind = kubernetes, it fails

(Screenshot 1: in-cluster connection deletion failed)
Because recently on remote provider side the method which returns connection was update to return connection (previously it was returning k8s context if kind = kubernetes).
Update here to use a proper new method, which returns k8s context by connection id
(Screenshot 2: in-cluster connection deletion successful)
Signed commits