-
Notifications
You must be signed in to change notification settings - Fork 167
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
HTTP requests to arbitrary path #389
Comments
Naming is hardShouldn't call it My next idea was => Provisionally calling it |
#428 has a use case for requesting same discovery info kubeclient does, which would be a wasteful request. And generally, many use cases here like Extended proposal (not atomic, just the first is already valuable):
Could/should |
@cben did you make any progress here? I want to use the client to consume https://github.com/kubernetes-sigs/metrics-server/ but the api lives in How exactly can I help here? I would be happy to get my hands dirty if you give me some insight on what design you were thinking of following. |
Yes we did! Since #466 on master branch But client = Kubeclient::Client.new('http://SERVER:6443/apis/metrics.k8s.io', 'v1beta1') |
This worked flawlessly. Thanks a bunch. I am using master with ruby 3. |
STATUS: exists on master, undocumented
A few use cases have come up over time for making arbitrary HTTP requests to the server, that probably don't justify builtin methods in kubeclient. Generally, users wish the library covered 100% of their needs, but it's not always reasonable to inflate API surface (especially for k8s derivative-specific stuff like openshift), nor to force users to wait until their use case is added to the library.
Use cases
/healthz
(k8s),/healthz/ping
,/healthz/ready
(possibly openshift specific?)./version
(k8s),/version/openshift
(openshift v3, replaced by CRDs in v4).kubectl cluster-info
which hits many URLs./apis
and/apis/SOMEGROUP
? Maybe deserves native support./apis/SOMEGROUP/SOMEVERSION
? Maybe deserves native support.Non-goals, until proven otherwise
kubectl exec
? #353 needs POST but also WebSocket and lots of low-level stuff, not "simple escape hatch" material!Shouldn't expose underlying clientI think adding a generic "custom request to this path" is a good escape hatch, IFF we can cover it with a small API.
Technically, you can already do arbitrary requests via
kclient.create_rest_client(path).get.body
but that's deliberately undocumented, we'd like to switch away from RestClient (#237, more pressing as RestClient is presently unmaintained). Even if we switch, by same logic, kubeclient shouldn't tie its API to specific client.UPDATE: I've changed my opinion since; after master moved to RestClient -> Faraday, we decided that Faraday actually provides reasonably abstracted API how to make http requests, and it's better to use an "aspiring standard one" than invent our own.
Proposed minimal viable API
Performs GET request.
path
is relative to api server "root" (cf. #318), not this Client's apis/group/version.Does kubeclient-typical error handling and parsing (use
as: :raw
to get unparsed string).The text was updated successfully, but these errors were encountered: