-
Notifications
You must be signed in to change notification settings - Fork 38.6k
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
update NewObject for groupversionkind #18379
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
I know we've gone through this before and you think we don't need to name the variable groupVersion because we've properly typed it now, but I still think naming it groupVersion is better for readability. For example, when reading this line, now I have to find the definition of
version
to know what's contained in it.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.
Doesn't that end up feeling like hungarian notation? I'd say that
group
is astring
,version
is aGroupVersion
, andkind
is aGroupVersionKind
. Any variant deserves a different name.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.
@derekwaynecarr I know you were against
gv
andgvk
. Do you have an opinion?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.
Actually do we have variable
version
that is aGroupVersion.Version
? If not, I'm fine with usingversion
forGroupVersion
everywhere.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.
I think
GroupVersionKind
type name is basically Hungarian notation since its more prescriptive of the individual values it holds than the use case it fulfills. The contrast in my head is we don't call where your home is a "NumberStreetCityStateZIP", it's anAddress
.That said, tuple and triplet naming is awkward, and I am not surprised we went down that path since we are mostly trying to clean up existing code that had them as three separate fields. So I am not against
GroupVersion
orGroupVersionKind
, but if we create aGroupVersionKindField
, to describe a field in the API, and start creatinggvkf
acronyms in the code, we have gone too far.To me, I would think things as follows:
group
is astring
GroupVersion
is more like aPackage
if I were to take Java naming conventions. This also make sense to me since if we start to support third-party API groups, I would want to add the other fields to aPackage
like vendor for example.kind
is aKind
, which is a fully qualified means of addressing an object in aPackage
. sokind.Kind
is astring
, andkind.Package
is aPackage
.field
is aField
, which is a fully qualified means of addressing a member in aKind
. sofield.Field
would be a name we can pass into reflection, etc.If we are not wanting to describe things in something more akin to the above convention, then I think its confusing to not expand our internal acronyms for folks that come into the code. I prefer clarity so
gv
becomesgroupVersion
,gvk
becomesgroupVersionKind
.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.
I think somewhere smarterclayton, lavalamp, and bgrant0607 has agreed vendor should be part of the GroupVersion.Group, and use "." to delimiter vendor and 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.
@caesarxuchao - I think what we name each token in a URL path is different than what we call the collection of path segments in the internal API server code base. I still think
Package
is a more sensible name for what it is thanGroupVersion
, andGroupVersionKind
is an eye-sore, and when I know we end up doingGroupVersionKindField
we will all hate ourselves little on the inside ;-)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, you are right.
Package
sounds too generic. This struct currently lives in packageunversioned
, so in most places we would refer it asunversioned.Package
, which doesn't contain much information. Perhaps something likeAPIPackage
.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, group should be a domain name for disambiguation (mygroup.mycompany.com).
We should probably make explicit that our groups with no domain following
are in the k8s.io domain or some such.
On Wed, Dec 9, 2015 at 11:28 PM, Chao Xu notifications@github.com wrote: