Code Monkey home page Code Monkey logo

Comments (6)

olymk2 avatar olymk2 commented on June 2, 2024 2

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.

from k8s-api.

deas avatar deas commented on June 2, 2024

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!

from k8s-api.

RafaeLeal avatar RafaeLeal commented on June 2, 2024

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.

from k8s-api.

deas avatar deas commented on June 2, 2024

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. ;)

from k8s-api.

Dangercoder avatar Dangercoder commented on June 2, 2024

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

from k8s-api.

blak3mill3r avatar blak3mill3r commented on June 2, 2024

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.

from k8s-api.

Related Issues (6)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.