kubernetes-client icon indicating copy to clipboard operation
kubernetes-client copied to clipboard

Move to Vert.x HTTP Client

Open gastaldi opened this issue 3 years ago • 7 comments

Okhttp is no longer a single JAR and 4.x brings transitive dependencies (the kotlin-stdlib which is 1.5Mb).

There is a discussion about adopting Vert.x as the HTTP client here: https://github.com/quarkusio/quarkus/pull/14662

Fixing this issue needs to also fix the problem reported in https://github.com/fabric8io/kubernetes-client/issues/2632

gastaldi avatar Jan 31 '21 00:01 gastaldi

Ideally, (but this might bring its own challenges) is to be agnostic of the HTTP Client, and make it pluggable, if users want to use Apache HttpClient 5, or OkHttp 4, or Vert.x HTTP Client, or what I consider a nice zero-dependency: Java 11 HttpClient, would be great, this way Kubernetes-Client will not force a particular dependency.

And yes, this is probably a more invasive change and is subject to more challenges that just stick to one dependency.

jorsol avatar Mar 03 '21 14:03 jorsol

@jorsol I think that's also possible, considering an abstraction layer is introduced in the HTTP operations part.

gastaldi avatar Mar 03 '21 14:03 gastaldi

This issue has been automatically marked as stale because it has not had any activity since 90 days. It will be closed if no further activity occurs within 7 days. Thank you for your contributions!

stale[bot] avatar Jun 01 '21 16:06 stale[bot]

Julien Viet provided an outline of a client support at https://github.com/shawkins/httpclient/pull/1

There is still a fair amount of work to be done.

shawkins avatar Mar 09 '22 17:03 shawkins

@metacosm @vietj @manusa I've picked this up again at https://github.com/fabric8io/kubernetes-client/tree/vertx-client

There are plenty of unsupported things and todos left. I'll take another couple of passes over it to see if I can get the consume and interceptor logic roughed in - then reach out for anything that isn't easy to move forward.

It's not yet used, but later I'm guessing we'll need to use the abstract builder to support creating derived clients - the only really tricky thing there is the modification of the interceptors that we do for the openshift logic. It switches to specific token interceptor, or removes itself when making the refresh call.

shawkins avatar May 06 '22 18:05 shawkins

@metacosm @vietj @manusa I've picked this up again at https://github.com/fabric8io/kubernetes-client/tree/vertx-client

Thx!

There are plenty of unsupported things and todos left. I'll take another couple of passes over it to see if I can get the consume and interceptor logic roughed in - then reach out for anything that isn't easy to move forward.

Oh, I was under the impression that https://github.com/shawkins/httpclient/pull/1 has the main hiccups addressed and would be possible after #3971 :disappointed:

manusa avatar May 07 '22 05:05 manusa

@vietj @metacosm I've made a few more changes, such as bringing in the WebClient dependency for interceptor handling. However it will speed things along if I can get some help with the following (marked with a TODO or unsupported exception in the code):

  • Confirmation that some of the config properties are not needed / meaningful - including should a general readTimeout be enforced
  • A few more config property implementations, such as SSL support, proxy support (seems like user / password may need to be passed separately),
  • Interceptor implementation - probably needs to be added per request to support the derived client modification of interceptors. Also needs to be applied to WebSocket requests.
  • Mapping to and from InputStream (send as a body, or receive) - is there another library for this already for compatibility with ReadStream/WriteStream?
  • Mapping to consumes methods

shawkins avatar May 10 '22 17:05 shawkins

Updated the pr a little bit more: https://github.com/fabric8io/kubernetes-client/tree/vertx-client - updated to master and pulled in a couple of prospective changes, such as removing the need for a sendAsync implementation (which addresses the InputStream/Reader line item above - except for when it's used in a POST).

However it's still pretty far from functional. Wiring in interceptors before a websocket invocation is straight-forward. Afterwards looks problematic - I think the only thing we can do is add exception handling to the future and try to differentiate between a response issue, and a more general IO problem.

We also aren't able to use the AbstractXXX test classes in the vertx module due to the conflicting junit versions.

shawkins avatar Oct 17 '22 17:10 shawkins

Work on the Vert.x HttpClient implementation is also being tracked at https://github.com/quarkusio/quarkus/issues/29520

manusa avatar Dec 15 '22 14:12 manusa

Quarkus has finally migrated to use the Vert.x HttpClient implementation. Closing this issue as complete.

As we gather feedback from the Vert.x implementation, in the future, we should consider to make Vert.x the default.

manusa avatar Feb 06 '23 11:02 manusa