obmarg / kazan

Kubernetes API client for Elixir
https://hex.pm/packages/kazan
MIT License
138 stars 35 forks source link

Support alternative swagger.json file #54

Closed chazsconi closed 5 years ago

chazsconi commented 5 years ago

We need to support the K8S metrics-server API (https://github.com/kubernetes-incubator/metrics-server) in our implementation.

To do this I need to fork the Kazan repo to make the following changes:

(https://github.com/chazsconi/kazan/commit/cd923bcab39a0a593b628ddb7d06fc87d694c6e9#diff-1856cab08f35cbaee3b304822e1699c4)

It would be nice if these two things could be set via the configuration.

Additionally I also had to manually change the swagger.json so the window field is a string rather than a Duration cause a crash when decoding, but this is really a different issue, and I'm not sure how to fix it properly.

https://github.com/chazsconi/kazan/commit/0e44c4ec6ca5f691443bad766f83c9147f9d2812

obmarg commented 5 years ago

Hey @chazsconi. This sounds like a useful feature to have, and I could probably throw it together pretty easily. How does swagger.json work when you've got something like metrics-server installed? Does k8s give you an updated swagger.json with all it's endpoints and any extra stuff you've got installed, or did you have to glue together something youreself?

chazsconi commented 5 years ago

@obmarg When you have metrics server installed, the endpoint /swagger.json will give you the updated file - no need to glue it together manually.

obmarg commented 5 years ago

@chazsconi I've put together a PR with this functionality in #57 if you want to take a look/try it out.

chazsconi commented 5 years ago

@obmarg Works well - thanks a lot! I added a comment in the PR.