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

fix(k8s): fix paths in requests to kubernetes api #5476

Merged
merged 2 commits into from Nov 23, 2023
Merged

Conversation

twelvemo
Copy link
Collaborator

@twelvemo twelvemo commented Nov 23, 2023

What this PR does / why we need it:
When using absolute paths in URLs e.g. /version for initializing the kubernetes provider, we need to remove the leading slash due to the way URL constructs the full URL. If we don't remove it, it is seen as an absolute path which leads to all other parts of the path to be stripped. For example if this URL is specified in the kubeconfig for a Kubernetes api server

https://rancher.18.194.162.172.sslip.io/k8s/clusters/c-m-qkrwsnsg

when adding the /version endpoint we get:

https://rancher.18.194.162.172.sslip.io/version

This causes the request to fail. Instead we need:

https://rancher.18.194.162.172.sslip.io/k8s/clusters/c-m-qkrwsnsg/version

This PR fixes this behavior.

Which issue(s) this PR fixes:

Fixes #

Special notes for your reviewer:

TimBeyer
TimBeyer previously approved these changes Nov 23, 2023
@TimBeyer TimBeyer added this pull request to the merge queue Nov 23, 2023
Merged via the queue into main with commit 783cc66 Nov 23, 2023
45 checks passed
@TimBeyer TimBeyer deleted the fix-paths-in-requests branch November 23, 2023 16:31
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

2 participants