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 bug for K8s API servers behind proxy #224

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

goyalankit
Copy link

@goyalankit goyalankit commented Jan 3, 2024

We have multiple Kubernetes servers behind a proxy and the current logic removes the URL prefix which causes a Bad Request.

For example:
According to the current logic:

self.endpoint = "https://hostname/cluster-1"
parts.uri = "/api/v1/namespaces/default/pods"
// strips the cluster-1 prefix
self.endpoint.join(&parts.uri.to_string())?; // https://hostname/api/v1/namespaces/default/pods

Error:

[cluster-1] [default] [none] > pods
Parse Error: Got unexpected status 400 Bad Request (Other(Err(Error("expected value", line: 1, column: 1))), 0)

The commit fixes the above situation by preserving the prefix url

@MortezaRamezani
Copy link

I think this line needs the change as well:

let url = self.endpoint.join(&parts.uri.to_string())?;

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.

2 participants