Skip to content

Parametrize resource path with version part of apiVersion #265

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

Merged
merged 3 commits into from
Jun 22, 2017
Merged

Parametrize resource path with version part of apiVersion #265

merged 3 commits into from
Jun 22, 2017

Conversation

ebbeelsborg
Copy link

Fixes #256 .

Also swaps the order of parameters "name" and "namespace" where relevant to match the standard API.

Note: This change will, intentionally, break consumers of the API that were relying on the version to always be "v1" without specifying it. Such consumers will now have to specify "v1" explicitly.

@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Jun 21, 2017
Copy link
Contributor

@codevulture codevulture left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for patch, Can you point me to a link where order is specified <name,namespace>.

@mbohlool
Copy link
Contributor

mbohlool commented Jun 21, 2017

OpenAPI spec has unrelated changes. I suggest you run update client script once to pull any changes upstream, then commit these changes, then add manual changes in a separate commit and then the third commit updating client again to apply effects on manual changes to the generated client. so total 3 commits:

commit1 - update generated client with no change (fetch upstream changes)
commit2 - my manual changes to do x and y
commit3 - update generated client after manual changes

I've added an issue to document these best practices: #266

@ebbeelsborg
Copy link
Author

@codevulture , Sure, here's an example: https://raw.githubusercontent.com/kubernetes-incubator/client-python/master/kubernetes/client/apis/core_v1_api.py (search for patch_namespaced_pod e.g.). Pardon the raw link, GitHub won't show the usual one right now. I realize that the ordering for declaring TPR resources is not <name, namespace>, but rather <namespace, name>, but for many of the standard APIs (Core V1, Extensions, Batch etc.) it seems to be the case that the ordering is <name, namespace>. And the Go APIs are a bit different as well. I don't feel strongly about it all, so if you wish, I can revert that part.

@ebbeelsborg
Copy link
Author

@mbohlool , Thanks. I tried to do what you suggested.

@codevulture , this second reincarnation is without swapping the name and namespace parameter ordering. If it is desired, I can put it back in, just let me know.

@mbohlool
Copy link
Contributor

@ebbeelsborg thanks. Almost there (commit-wise). Can you now use git rebase -i HEAD~7 and squash relevant commits together to make only three commits in my previous comment.

@codevulture
Copy link
Contributor

@ebbeelsborg : Thanks for your work, though it is a matter of choice. i wanted to understand the reason of change which you explained well.

@ebbeelsborg
Copy link
Author

@mbohlool , @codevulture , let me know if I need to do something more/different.

@mbohlool
Copy link
Contributor

Thanks @ebbeelsborg, it looks good. So to be clear, a name parameter was missing in the TPR spec and you added it, right? I liked reversing order of namespace and name but don't have strong opinion either way, let me know if you want me to merge it unchanged or you want to change the order before merge.

@ebbeelsborg
Copy link
Author

@mbohlool , Correct. A name parameter was missing for the update operation. I would like the PR merged as-is. Thanks.

Regarding the order of parameters name and namespace, I prefer to have name first. It would be a breaking change, but it seems that there aren't too many users of the TPR API yet so probably that's okay (and better now than later). I'll make a new PR for that, okay?

(I haven't tested it, but I suspect that the delete operation will need a similar make-over.)

@mbohlool
Copy link
Contributor

Sure, will merge this one. Thanks.

@mbohlool mbohlool merged commit 04f059a into kubernetes-client:master Jun 22, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cncf-cla: yes Indicates the PR's author has signed the CNCF CLA.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants