Skip to content
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

Merged

Conversation

caesarxuchao
Copy link
Member

@caesarxuchao caesarxuchao commented Apr 27, 2017

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.

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

This change is Reviewable

@k8s-github-robot k8s-github-robot added kind/api-change Categorizes issue or PR as related to adding, removing, or otherwise changing an API size/L Denotes a PR that changes 100-499 lines, ignoring generated files. release-note-label-needed labels Apr 27, 2017
@caesarxuchao caesarxuchao assigned lavalamp and unassigned timothysc and wojtek-t Apr 27, 2017
@caesarxuchao
Copy link
Member Author

/release-note-none

@k8s-ci-robot k8s-ci-robot added release-note-none Denotes a PR that doesn't merit a release note. and removed release-note-label-needed labels Apr 27, 2017
@k8s-github-robot k8s-github-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Apr 28, 2017
@k8s-github-robot k8s-github-robot added size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. and removed size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Apr 28, 2017
@caesarxuchao
Copy link
Member Author

caesarxuchao commented May 15, 2017

/assign @mbohlool

@k8s-ci-robot
Copy link
Contributor

@caesarxuchao: GitHub didn't allow me to assign the following users: mehdy.

Note that only kubernetes members can be assigned..

In response to this:

/assign @mehdy

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.

@caesarxuchao
Copy link
Member Author

@mbohlool the first commit is the code-gen change, the second and third commits are just sample outputs.

Copy link
Contributor

@mbohlool mbohlool left a 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.

@@ -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
Copy link
Contributor

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?

Copy link
Member Author

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.

Copy link
Member Author

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

@@ -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 \
Copy link
Contributor

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?

Copy link
Member Author

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":
Copy link
Contributor

Choose a reason for hiding this comment

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

const?

Copy link
Member Author

Choose a reason for hiding this comment

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

Ack.

@mbohlool mbohlool self-assigned this May 18, 2017
const tagName = "k8s:conversion-gen"
const externalTypesTagName = "k8s:conversion-gen-external-types"
Copy link
Member Author

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

@@ -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
Copy link
Member Author

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

@caesarxuchao
Copy link
Member Author

@mbohlool could you take another look at the first commit? I made a small change to it.

@caesarxuchao
Copy link
Member Author

Updated to cope with the latest gengo changes in https://github.com/kubernetes/gengo/pull/54/files

@mbohlool
Copy link
Contributor

mbohlool commented Jun 1, 2017

"fix conversion-gen" commit looks good to me.

@caesarxuchao
Copy link
Member Author

Thanks, @mbohlool. I'll rebase the PR once #46742 is merged. I'll apply the label so that we don't miss the code freeze.

@caesarxuchao caesarxuchao added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Jun 1, 2017
@caesarxuchao caesarxuchao added this to the v1.7 milestone Jun 1, 2017
@k8s-github-robot k8s-github-robot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. and removed lgtm "Looks good to me", indicates that a PR is ready to be merged. needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. kind/api-change Categorizes issue or PR as related to adding, removing, or otherwise changing an API size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. labels Jun 5, 2017
@caesarxuchao
Copy link
Member Author

Rebased. Adding back the lgtm.

@caesarxuchao caesarxuchao added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Jun 5, 2017
@grodrigues3
Copy link
Contributor

Hey @caesarxuchao if you use /lgtm that will also approve the PR when you are an approver.

@@ -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"
Copy link
Member

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.
Copy link
Member

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.

@k8s-github-robot k8s-github-robot removed the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Jun 7, 2017
@caesarxuchao
Copy link
Member Author

Added the doc. @lavalamp PTAL. Thanks.

@marun marun added the sig/api-machinery Categorizes an issue or PR as relevant to SIG API Machinery. label Jun 8, 2017
@lavalamp
Copy link
Member

lavalamp commented Jun 9, 2017

/lgtm
/approve

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Jun 9, 2017
@k8s-github-robot
Copy link

[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 /approve in a comment
You can cancel your approval by writing /approve cancel in a comment

@k8s-github-robot k8s-github-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jun 9, 2017
@k8s-ci-robot
Copy link
Contributor

k8s-ci-robot commented Jun 9, 2017

@caesarxuchao: The following tests failed, say /retest to rerun them all:

Test name Commit Details Rerun command
Jenkins Bazel Build 28f20b9d1459257d01477c7b3e8c7dd58b42ca4b link @k8s-bot bazel test this
Jenkins GCE Node e2e 28f20b9d1459257d01477c7b3e8c7dd58b42ca4b link @k8s-bot node e2e test this
Jenkins unit/integration 28f20b9d1459257d01477c7b3e8c7dd58b42ca4b link @k8s-bot unit test this
Jenkins Kubemark GCE e2e 28f20b9d1459257d01477c7b3e8c7dd58b42ca4b link @k8s-bot kubemark e2e test this
Jenkins verification 28f20b9d1459257d01477c7b3e8c7dd58b42ca4b link @k8s-bot verify test this
Jenkins kops AWS e2e 28f20b9d1459257d01477c7b3e8c7dd58b42ca4b link @k8s-bot kops aws e2e test this
Jenkins GCE etcd3 e2e 28f20b9d1459257d01477c7b3e8c7dd58b42ca4b link @k8s-bot gce etcd3 e2e test this
pull-kubernetes-federation-e2e-gce 21bba61e0120cc21cf52d10d098ac160579d1bad link @k8s-bot pull-kubernetes-federation-e2e-gce test this

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.

@caesarxuchao
Copy link
Member Author

@k8s-bot pull-kubernetes-e2e-gce-etcd3 test this

@k8s-github-robot
Copy link

Automatic merge from submit-queue (batch tested with PRs 45057, 47259)

@k8s-github-robot k8s-github-robot merged commit e1efc54 into kubernetes:master Jun 9, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. release-note-none Denotes a PR that doesn't merit a release note. sig/api-machinery Categorizes an issue or PR as relevant to SIG API Machinery. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

10 participants