Skip to content

Conversation

n2h9
Copy link
Contributor

@n2h9 n2h9 commented Aug 9, 2025

Notes for Reviewers

  • This PR fixes updates the url to get the k8s context by connection id.

Right now when user tried to delete connection which has kind = kubernetes, it fails
scren-0005
(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

screen-0006

(Screenshot 2: in-cluster connection deletion successful)

Signed commits

  • Yes, I signed my commits.

Signed-off-by: Nikita B <n2h9z4@gmail.com>
Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a 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 in server/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

  1. 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.

@n2h9 n2h9 changed the title chore: update remove provider url for obtaining k8s context by id chore: update remote provider url for obtaining k8s context by id Aug 9, 2025
Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a 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))
Copy link
Contributor

Choose a reason for hiding this comment

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

critical

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.

Suggested change
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
}

Copy link

github-actions bot commented Aug 9, 2025

@n2h9 n2h9 temporarily deployed to staging-playground August 9, 2025 12:25 — with GitHub Actions Inactive
Copy link

codecov bot commented Aug 9, 2025

Codecov Report

❌ Patch coverage is 0% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 5.32%. Comparing base (dcfaef3) to head (e29f458).
⚠️ Report is 111 commits behind head on master.

Files with missing lines Patch % Lines
server/models/remote_provider.go 0.00% 1 Missing ⚠️
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           
Flag Coverage Δ
unittests 5.32% <0.00%> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link

github-actions bot commented Aug 9, 2025

Commit SHA: e29f4584aaaef528cfd52cb79dfeedd6d6e9f610

END-TO-END TESTS

  • Testing started at: August 9th 2025, 12:33:56 pm

📦 Test Result Summary

  • ✅ 69 passed
  • ❌ 3 failed
  • ⚠️ 9 flaked
  • ⏩ 3 skipped

Duration: 9 minutes and 19 seconds

Overall Result: 👎 Some tests failed.

[Show/Hide] Test Result Details
Test Browser Test Case Tags Result
1 chromium-meshery-provider Transition to disconnected state and then back to connected state
2 chromium-meshery-provider Transition to ignored state and then back to connected state
3 chromium-meshery-provider Transition to not found state and then back to connected state
4 chromium-meshery-provider Delete Kubernetes cluster connections
5 chromium-meshery-provider Configure Existing Istio adapter through Mesh Adapter URL from Management page unstable ⚠️
6 chromium-meshery-provider Connect to Meshery Istio Adapter and configure it
7 chromium-local-provider Transition to disconnected state and then back to connected state ⚠️
8 chromium-meshery-provider Ping Istio Adapter unstable ⚠️
9 chromium-local-provider Configure Existing Istio adapter through Mesh Adapter URL from Management page unstable ⚠️
10 chromium-local-provider Connect to Meshery Istio Adapter and configure it
11 chromium-local-provider Ping Istio Adapter unstable ⚠️

@n2h9 n2h9 merged commit 1e4a662 into meshery:master Aug 9, 2025
18 of 19 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant