Open deas opened 4 years ago
Played a little more. :)
https://github.com/martinklepsch/clj-http-lite works with watch
:
(let [res (http-light/get "http://127.0.0.1:8001/api/v1/namespaces/default/pods?watch=true"
{:as :stream})
rdr (-> (:body res) (InputStreamReader. "UTF8") BufferedReader.)
items (parsed-seq rdr)]
(doseq [item items] (println item)))
Swapping clj-http
for clj-http-lite
in martian does not appear to be difficult either. Not saying things will be working though. Will give it a try ;)
Happy easter!
Hey! Thanks for the report :)
Yeah, this is very annoying in fact.. the problem is that the Kubernetes API doesn't follow HTTP 1.1 spec on chunked responses. So it's not http-kit
limitation actually 😞 .
I'm considering following martian approach to decouple from http implementation.. but I'm not sure yet.
I got watch
and client pluggability working in k8s-api. When using watch
, the client gets a (blocking) sequence of maps. This works with clj-http-lite
and iirc also with clj-http
. It does not yet work with httpkit
, but there are no regressions in the httpkit
implementation either.
At the moment, the k8s-api detects the client implementation from the environment (for compatibility). Not sure if this is what we want or whether we want to set it explicitly. There are also other areas which do not yet look clean to me. Would be great if you could check so the changes get into your master
branch.
Feel free to check: https://github.com/deas/k8s-api/commits/pluggable-client
BTW: I landed a commit adding clj-http-lite
in martian master. ;)
Any news on this? I'm in need of the watch functionality as well.
edit: I embraced java interop and went with https://github.com/fabric8io/kubernetes-client for the --watch functionality
Glad to see someone working on this! I did an experiment using the watch
k8s API from clojure a while back. It is 3+ years old and it might not be relevant. I mention it anyway in case it is of some use/interest.
https://github.com/blak3mill3r/keenest-rube/blob/master/src/rube/request.clj#L61 I used aleph.http
for the chunked response parsing and wound up with a core.async channel of EDN from k8s.
nice to see this is being worked on any reason the work in @deas branch cant be implemented watch would be really nice to see.
Been playing with
k8s-api
for a while and I really like it.However, I need
watch
support. Saw the docstring mentioning https://github.com/kubernetes/kubernetes/issues/50857. Watch is the gateway to operators, and I am wondering how to get support in.I also like
http-kit
in general but it appears to lack maintenance and it also appears to require some patching to getwatch
working. The next issue I encountered was lack of tls support with Java 11 in the stable version. Not super important at the moment but I'd expect graal support to be a problem as well.Don't get me wrong: I am not saying we should be departing from
http-kit
immediately. I'd be fine using something else towatch
for now. However, I'd also be willing to help getting support intok8s-api
. ;)Do you have any long term vision with regards to the http library/libraries to use in
k8s-api
?