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

Fix Proto Generator to not assign types to packages they don't belong to #67169

Merged
merged 2 commits into from Aug 17, 2018

Conversation

@mbohlool
Member

mbohlool commented Aug 8, 2018

Before this PR, types were assign to the first package they defined or being used. This result in wrong import statements. The change also fixes what #67158 tries to fix as the package path for protos will never empty.

An step forward from #67158

/assign @sttts @smarterclayton

@k8s-ci-robot

This comment has been minimized.

Show comment
Hide comment
@k8s-ci-robot

k8s-ci-robot Aug 8, 2018

Contributor

@mbohlool: Adding the "do-not-merge/release-note-label-needed" label because no release-note block was detected, please follow our release note process to remove it.

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.

Contributor

k8s-ci-robot commented Aug 8, 2018

@mbohlool: Adding the "do-not-merge/release-note-label-needed" label because no release-note block was detected, please follow our release note process to remove it.

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.

mbohlool added some commits Aug 8, 2018

Fix Proto Generator to not assign types to packages they don't belong to
The wrong type assignment resulted in wrong imports
@@ -116,7 +116,10 @@ func assignGoTypeToProtoPackage(p *protobufPackage, t *types.Type, local, global
}
return
}
global[t.Name] = p
if t.Name.Package == p.PackagePath {

This comment has been minimized.

@sttts

sttts Aug 9, 2018

Contributor

isn't this wrong? Globals should be global types, i.e. cross package. You don't store those globals.

@sttts

sttts Aug 9, 2018

Contributor

isn't this wrong? Globals should be global types, i.e. cross package. You don't store those globals.

This comment has been minimized.

@sttts

sttts Aug 9, 2018

Contributor

@mbohlool can you verify the role of "globals"? Why is this correct?

@sttts

sttts Aug 9, 2018

Contributor

@mbohlool can you verify the role of "globals"? Why is this correct?

This comment has been minimized.

@sttts

sttts Aug 17, 2018

Contributor

This is correct because we track global, named types in global and follow the topological import order. So registering them from their own package is enough.

@sttts

sttts Aug 17, 2018

Contributor

This is correct because we track global, named types in global and follow the topological import order. So registering them from their own package is enough.

@sttts

This comment has been minimized.

Show comment
Hide comment
@sttts

sttts Aug 9, 2018

Contributor

The output of this and #67158 is 100% the same. So which one looks more correct? :)

Contributor

sttts commented Aug 9, 2018

The output of this and #67158 is 100% the same. So which one looks more correct? :)

@sttts

This comment has been minimized.

Show comment
Hide comment
@sttts

sttts Aug 17, 2018

Contributor

/hold cancel
/lgtm
/approve

Contributor

sttts commented Aug 17, 2018

/hold cancel
/lgtm
/approve

@sttts

This comment has been minimized.

Show comment
Hide comment
@sttts

sttts Aug 17, 2018

Contributor

/assign @smarterclayton

Can you approve? This one is correct. Closing #67158.

Contributor

sttts commented Aug 17, 2018

/assign @smarterclayton

Can you approve? This one is correct. Closing #67158.

@sttts

This comment has been minimized.

Show comment
Hide comment
@sttts

sttts Aug 17, 2018

Contributor

/retest

Contributor

sttts commented Aug 17, 2018

/retest

@smarterclayton

This comment has been minimized.

Show comment
Hide comment
@smarterclayton

smarterclayton Aug 17, 2018

Contributor

/approve

Contributor

smarterclayton commented Aug 17, 2018

/approve

@k8s-ci-robot

This comment has been minimized.

Show comment
Hide comment
@k8s-ci-robot

k8s-ci-robot Aug 17, 2018

Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: mbohlool, smarterclayton, sttts

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

Contributor

k8s-ci-robot commented Aug 17, 2018

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: mbohlool, smarterclayton, sttts

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-merge-robot

This comment has been minimized.

Show comment
Hide comment
@k8s-merge-robot

k8s-merge-robot Aug 17, 2018

Contributor

Automatic merge from submit-queue (batch tested with PRs 67062, 67169, 67539, 67504, 66876). If you want to cherry-pick this change to another branch, please follow the instructions here.

Contributor

k8s-merge-robot commented Aug 17, 2018

Automatic merge from submit-queue (batch tested with PRs 67062, 67169, 67539, 67504, 66876). If you want to cherry-pick this change to another branch, please follow the instructions here.

@k8s-merge-robot k8s-merge-robot merged commit 97215fe into kubernetes:master Aug 17, 2018

18 checks passed

Submit Queue Queued to run github e2e tests a second time.
Details
cla/linuxfoundation mbohlool authorized
Details
pull-kubernetes-bazel-build Job succeeded.
Details
pull-kubernetes-bazel-test Job succeeded.
Details
pull-kubernetes-cross Skipped
pull-kubernetes-e2e-gce Job succeeded.
Details
pull-kubernetes-e2e-gce-100-performance Job succeeded.
Details
pull-kubernetes-e2e-gce-device-plugin-gpu Job succeeded.
Details
pull-kubernetes-e2e-gke Skipped
pull-kubernetes-e2e-kops-aws Job succeeded.
Details
pull-kubernetes-e2e-kubeadm-gce Skipped
pull-kubernetes-integration Job succeeded.
Details
pull-kubernetes-kubemark-e2e-gce-big Job succeeded.
Details
pull-kubernetes-local-e2e Skipped
pull-kubernetes-local-e2e-containerized Skipped
pull-kubernetes-node-e2e Job succeeded.
Details
pull-kubernetes-typecheck Job succeeded.
Details
pull-kubernetes-verify Job succeeded.
Details
@jberkus

This comment has been minimized.

Show comment
Hide comment
@jberkus

jberkus Aug 20, 2018

@mbohlool, @sttts

Where is the release note on this PR?

jberkus commented Aug 20, 2018

@mbohlool, @sttts

Where is the release note on this PR?

@sttts

This comment has been minimized.

Show comment
Hide comment
@sttts

sttts Aug 21, 2018

Contributor

Where is the release note on this PR?

none needed. Updated the labels.

Contributor

sttts commented Aug 21, 2018

Where is the release note on this PR?

none needed. Updated the labels.

@sttts

This comment has been minimized.

Show comment
Hide comment
@sttts

sttts Aug 23, 2018

Contributor

The wrong dependencies bite us in https://github.com/openshift/api where we don't vendor k8s.io/apiextensions-apiserver, but the proto import in corev1 requires it.

Creating a backport.

Contributor

sttts commented Aug 23, 2018

The wrong dependencies bite us in https://github.com/openshift/api where we don't vendor k8s.io/apiextensions-apiserver, but the proto import in corev1 requires it.

Creating a backport.

k8s-merge-robot added a commit that referenced this pull request Sep 4, 2018

Merge pull request #67754 from sttts/automated-cherry-pick-of-#67169-…
…upstream-release-1.11

Automatic merge from submit-queue.

Automated cherry pick of #67169: Fix Proto Generator to not assign types to packages they don't belong to

This produces correct protobuf dependencies. Without, everybody basing custom types onto k8s.io/api and who uses protobuf, will run into arbitrary dependencies on apiextensions-apiserver and others.

```release-note
Fix protobuf dependencies in k8s.io/api.
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment