Skip to content

Add create, update and delete protocol buffer methods.#71

Merged
mbohlool merged 3 commits into
kubernetes-client:masterfrom
brendandburns:proto
Sep 20, 2017
Merged

Add create, update and delete protocol buffer methods.#71
mbohlool merged 3 commits into
kubernetes-client:masterfrom
brendandburns:proto

Conversation

@brendandburns

Copy link
Copy Markdown
Contributor

Finishes off basic protocol buffer support. It's not perfect, but it's usable.

@mbohlool @lwander

* 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

Copy link
Copy Markdown
Contributor

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)?

Copy link
Copy Markdown
Contributor Author

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)

Copy link
Copy Markdown
Contributor

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.

@@ -81,31 +151,50 @@ public <T extends Message> T list(T.Builder listObj, String path) throws ApiExce
* @param path The URL path to call (e.g. /api/v1/namespaces/default/pods/pod-name)
* @return A Message of type T
*/

Copy link
Copy Markdown
Contributor

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?

Copy link
Copy Markdown
Contributor Author

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)

Copy link
Copy Markdown
Contributor

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.

Copy link
Copy Markdown
Contributor Author

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.

@mbohlool

Copy link
Copy Markdown
Contributor

First round of review done. Thanks.

@brendandburns

Copy link
Copy Markdown
Contributor Author

@mbohlool comments (mostly) addressed, ptal.

Thanks!
--brendan

@mbohlool

mbohlool commented Sep 17, 2017

Copy link
Copy Markdown
Contributor

@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.

@brendandburns

brendandburns commented Sep 17, 2017 via email

Copy link
Copy Markdown
Contributor Author

@mbohlool

Copy link
Copy Markdown
Contributor

Sure.

@mbohlool mbohlool left a comment

Copy link
Copy Markdown
Contributor

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

Copy link
Copy Markdown
Contributor

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)

Copy link
Copy Markdown
Contributor

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?

Copy link
Copy Markdown
Contributor Author

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)

@brendandburns

Copy link
Copy Markdown
Contributor Author

Tried to address the comments, please take another look.

@mbohlool

Copy link
Copy Markdown
Contributor

/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 :) )

@mbohlool mbohlool merged commit dd979d0 into kubernetes-client:master Sep 20, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants