-
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
Implement usage of nested APIs #457
Conversation
This would also yield to fix https://gitlab.com/gitlab-org/gitlab/-/issues/22043 |
This is awesome and very important, thanks a lot for tackling this! ❤️
|
Thanks for those pointers. I will take a look at that :) |
@cben I just force-pushed an amended commit, that includes the tests you asked for. Would you mind reviewing it? :) |
Just saw, that rubocop failed. Will fix that real quick |
`handle_uri` expected the Kubernetes API to be rooted at `/` if more than 2 components were included in the provided URL. This was done to extract a potential `api_group` from the URL. This commit changes that behaviour, to parse that `api_group` via a regex, rather than leaning on a strict URL pattern. This commit also takes into account, that OpenShift uses `/oapi`, as well as including a test-suite for that new API URL handling. Tests also include checks for the `@api_group` and `@api_version` instance variables and a non-default version. Implements ManageIQ#318 Fixes ManageIQ#418
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perfect 💯
Thanks again!
client = Kubeclient::Client.new('http://localhost:8080/apis/this_is_the_group', 'v1') | ||
rest_client = client.rest_client | ||
assert_equal('v1', client.instance_variable_get(:@api_version)) | ||
assert_equal('this_is_the_group/', client.instance_variable_get(:@api_group)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The trailing slash looked surprising to me, but yep, we had it before and we're sending
hash[:apiVersion] = @api_group + @api_version
so this is good ✔️.
(Also this representation is convenient for automatically handling both foo/v1
and core v1
)
I'll release this by Sunday. |
Implement usage of nested APIs
Well, for a sufficiently late definition of "Sunday". Released 4.9.1. |
handle_uri
expected the Kubernetes API to be rooted at/
if more than 2components were included in the provided URL. This was done to extract a
potential
api_group
from the URL.This commit changes that behaviour, to parse that
api_group
via a regex,rather than leaning on a strict URL pattern.
This commit also takes into account, that OpenShift uses
/oapi
, as wellas including a test-suite for that new API URL handling.
Implements #318
Fixes #418