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

Missing "/" in request url while using customresource client #1803

Closed
just1900 opened this issue Oct 9, 2019 · 7 comments · Fixed by #1804
Closed

Missing "/" in request url while using customresource client #1803

just1900 opened this issue Oct 9, 2019 · 7 comments · Fixed by #1804

Comments

@just1900
Copy link

just1900 commented Oct 9, 2019

Problem

  • while using client.customResource(csvContext).create() for creating customresource, I'm running into this Exception below, my client is initialized from a kubeconfig file whose apiserver endpoint is https://x.x.x.x:7443.
java.lang.IllegalArgumentException: Invalid URL port: "7443apis"
	at okhttp3.HttpUrl$Builder.parse(HttpUrl.java:1397)
	at okhttp3.HttpUrl.get(HttpUrl.java:916)
	at okhttp3.Request$Builder.url(Request.java:165)
	at io.fabric8.kubernetes.client.dsl.internal.RawCustomResourceOperationsImpl.getRequest(RawCustomResourceOperationsImpl.java:264)
	at io.fabric8.kubernetes.client.dsl.internal.RawCustomResourceOperationsImpl.makeCall(RawCustomResourceOperationsImpl.java:223)
	at io.fabric8.kubernetes.client.dsl.internal.RawCustomResourceOperationsImpl.validateAndSubmitRequest(RawCustomResourceOperationsImpl.java:239)
	at io.fabric8.kubernetes.client.dsl.internal.RawCustomResourceOperationsImpl.create(RawCustomResourceOperationsImpl.java:70)

Cause

Personal Opinion

I think we should append"/" before append("apis/") which should be looked like this

urlBuilder.append("/")
  .append("apis/")
  .append() // others
  • kubeconfig file do not contain "/" in server's endpoint
  • In most cases, config.getMasterUrl() shall return the host without "/", right?
@rohanKanojia
Copy link
Member

@legendj : Strange, my minikube also has apiserver endpoint like yours but I don't face this error:

 18 - cluster:
 19     certificate-authority: /home/rohaan/.minikube/ca.crt
 20     server: https://192.168.99.100:8443
 21   name: minikube

But I think appending a / explicitly does no harm

@rohanKanojia
Copy link
Member

@legendj : Hi, I've created a PR for fixing this. Could you please build a snapshot and test it whether it's working for you or not?

git clone <repo-url>
git fetch origin pull/1804/head:pullReq1804 && git checkout pullReq1804
mvn clean install -DskipTests
# Use 4.6-SNAPSHOT instead of 4.6.0

rohanKanojia added a commit to rohanKanojia/kubernetes-client that referenced this issue Oct 9, 2019
@rohanKanojia
Copy link
Member

@legendj : polite ping, Did you get time to try it out?

@just1900
Copy link
Author

@rohanKanojia sorry for the delay, I've test it just now and it worked fine. you can close the issue now

@rohanKanojia
Copy link
Member

@legendj : You mean you tested my PR or you were unable to reproduce the issue itself?

@just1900
Copy link
Author

@rohanKanojia using the new, PR verision

@rohanKanojia
Copy link
Member

oh, okay. I would merge it and notify you on next release

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants