-
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
Allow conversion-gen to take types that are not in the output path #45057
Allow conversion-gen to take types that are not in the output path #45057
Conversation
/release-note-none |
0c0ac8d
to
0f91d24
Compare
/assign @mbohlool |
@caesarxuchao: GitHub didn't allow me to assign the following users: mehdy. Note that only kubernetes members can be assigned.. In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. I understand the commands that are listed here. |
@mbohlool the first commit is the code-gen change, the second and third commits are just sample outputs. |
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.
generally looks good. some nits.
Makefile.generated_files
Outdated
@@ -35,7 +35,7 @@ SHELL := /bin/bash | |||
# This rule collects all the generated file sets into a single rule. Other | |||
# rules should depend on this to ensure generated files are rebuilt. | |||
.PHONY: generated_files | |||
generated_files: gen_deepcopy gen_defaulter gen_conversion gen_openapi |
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 assume this change suppose to be temporary, right? can you revert 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.
Sure, sorry. The PR is extracted from many local commits.
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 two makefile changes are from commit 2 and 3, they will be removed before merge :)
Makefile.generated_files
Outdated
@@ -222,7 +222,7 @@ RUN_GEN_DEEPCOPY = \ | |||
--v $(KUBE_VERBOSE) \ | |||
--logtostderr \ | |||
-i $$(cat $(META_DIR)/$(DEEPCOPY_GEN).todo | paste -sd, -) \ | |||
--bounding-dirs $(PRJ_SRC_PATH) \ | |||
--bounding-dirs $(PRJ_SRC_PATH),k8s.io/api \ |
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.
why manually adding this? and why it is not a full path?
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.
Will be removed before merge. Only the first commit is relevant.
v = kv[1] | ||
} | ||
switch k { | ||
case "external_types": |
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.
const?
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.
Ack.
0f91d24
to
28f20b9
Compare
const tagName = "k8s:conversion-gen" | ||
const externalTypesTagName = "k8s:conversion-gen-external-types" |
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.
@mehdy sorry i made a change after you last time reviewed it. I added the externalTypesTagName
for user to specify where the external types are, instead of squeeze it with the existing tagName
. This is more consistent with the way i updated the default-gen (kubernetes/gengo#54).
pkg/api/v1/doc.go
Outdated
@@ -16,6 +16,7 @@ limitations under the License. | |||
|
|||
// +k8s:deepcopy-gen=package,register | |||
// +k8s:conversion-gen=k8s.io/kubernetes/pkg/api | |||
// +k8s:conversion-gen-external-types=../../../vendor/k8s.io/api/core/v1 |
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.
@mbohlool the tag looks like this
@mbohlool could you take another look at the first commit? I made a small change to it. |
28f20b9
to
21bba61
Compare
Updated to cope with the latest gengo changes in https://github.com/kubernetes/gengo/pull/54/files |
"fix conversion-gen" commit looks good to me. |
21bba61
to
0868b5b
Compare
Rebased. Adding back the lgtm. |
Hey @caesarxuchao if you use |
@@ -46,13 +46,18 @@ type CustomArgs struct { | |||
SkipUnsafe bool | |||
} | |||
|
|||
// This is the comment tag that carries parameters for conversion generation. | |||
// There are the comment tags that carry parameters for conversion generation. | |||
const tagName = "k8s:conversion-gen" |
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.
nit: use a const ()
block
@@ -46,13 +46,18 @@ type CustomArgs struct { | |||
SkipUnsafe bool | |||
} | |||
|
|||
// This is the comment tag that carries parameters for conversion generation. | |||
// There are the comment tags that carry parameters for conversion generation. |
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.
s/There/These/
Document what argument these tag names accept and its exact format.
0868b5b
to
ab71a6e
Compare
Added the doc. @lavalamp PTAL. Thanks. |
/lgtm |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: caesarxuchao, lavalamp Associated issue: 44065 The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these OWNERS Files:
You can indicate your approval by writing |
@caesarxuchao: The following tests failed, say
Full PR test history. Your PR dashboard. Please help us cut down on flakes by linking to an open issue when you hit one in your PR. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. I understand the commands that are listed here. |
@k8s-bot pull-kubernetes-e2e-gce-etcd3 test this |
Automatic merge from submit-queue (batch tested with PRs 45057, 47259) |
Part of fixing #44065.
Partially address kubernetes/enhancements#282.
The first commit is the changes to the conversion-gen (and vendor).
The second commit moves the api/v1 types to staging, and the third commit shows the resulted changes in the generated conversions.