-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
Add create, update and delete protocol buffer methods. #71
Conversation
* Delete a kubernetes API object using protocol buffer encoding. | ||
* @param builder The builder for the response | ||
* @param path The path to call in the API server | ||
* @return The response received |
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.
Maybe document that delete returns only status and others will return object (if they do)?
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.
done. (changed the return type)
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.
Should the document for return value be the status response? ditto for other methods.
return request(builder, path, "DELETE", null, null, null); | ||
} | ||
|
||
/** | ||
* Generic protocol buffer based HTTP request. | ||
* Not intended for general consumption, but public for advance use cases. | ||
* @param builder The appropriate Builder for the object receveived from the request. | ||
* @param method The HTTP method (e.g. GET) for this request. | ||
* @param path The URL path to call (e.g. /api/v1/namespaces/default/pods/pod-name) | ||
* @return A Message of type T |
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.
add documentation for new fields body, apiVersion, kind?
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.
done.
* @param kind The kind of the object | ||
* @return The response received. | ||
*/ | ||
public <T extends Message> ObjectOrStatus<T> create(T obj, String path, String apiVersion, String kind) |
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.
Until we find a generic way to do it, I suggest we extract apiVersion and kind from T using reflection. I know it is not ideal, but I prefer it vs adding these two parameters to the surface of our proto APIs. ditto for other calls.
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.
Sadly, the fields aren't present in the proto. See the long discussion here:
https://groups.google.com/forum/#!topic/kubernetes-sig-api-machinery/deP_LDaAdVs
Otherwise I would have used reflection.
First round of review done. Thanks. |
43e1a55
to
9ee52b0
Compare
@mbohlool comments (mostly) addressed, ptal. Thanks! |
9ee52b0
to
ea2729b
Compare
@brendandburns I went through that thread about protos and replied there. I think grpc proxy would be nice addition to our generated clients and it could solve the problem of all clients with one generated proxy. |
Sure. |
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.
some more comments but nothing serious.
* Delete a kubernetes API object using protocol buffer encoding. | ||
* @param builder The builder for the response | ||
* @param path The path to call in the API server | ||
* @return The response received |
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.
Should the document for return value be the status response? ditto for other methods.
* @param kind The kind of the object | ||
* @return The response received. | ||
*/ | ||
public <T extends Message> ObjectOrStatus<T> update(T obj, String path, String apiVersion, String kind) |
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.
is it possible for non-delete calls to return status?
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.
Yes, update in particular sometimes returns a 201 (I observed this behavior)
Tried to address the comments, please take another look. |
/lgtm I normally squash these type of PRs (when they have merge and duplicate commits and squash all in one commit make sense) to save time instead of asking author to do it. I will do the same here. Please speak up if you don't want me to do in this repo (or ever :) ) |
Finishes off basic protocol buffer support. It's not perfect, but it's usable.
@mbohlool @lwander