-
Notifications
You must be signed in to change notification settings - Fork 258
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
Updated containerd1.7; google.golang.org/protobuf #1706
Conversation
9a15d31
to
4a5886a
Compare
Can we split this into two PRs:
Edit: To clarify, I see from your description that we need to move to gogo to move to 1.7, but I'm wondering if we also have to move to 1.7 to move to gogo? |
4a5886a
to
cb76362
Compare
Yes, since if we move off of gogo, then our marshalling will differ from containerd1.6, and we wont be able to communicate with them (and likely won't implement task server correctly, since the return types will be different). edit: the task server interface specifies gogo return types: https://github.com/containerd/containerd/blob/de33abf0547cb56bed2b7ea74cbbf0fe903c00b8/runtime/v2/task/shim.pb.go#L3429 |
I'm confused by this. As long as both sides are speaking protobuf, it shouldn't matter what internal implementation types they use, right? |
@kevpar I think there's some bug in the protobuf code. With the cri-containerd tests, I've been seeing errors like this even on main because the protobuf versions are different:
|
technically since grpc isnt fully self-describing, it needs a type to unpack it into when unmarshalling the byte payload. |
I must be missing something here. Is there a specific example of the issue you can share? |
oh, youre right, I was mistaken.
|
cb76362
to
cbb3260
Compare
rebased to fix merge conflicts |
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.
lgtm. Should we make like a last release of the shim pre-containerd 1.7 change?
cbb3260
to
0cb4dd1
Compare
d115c70
to
fa9f441
Compare
b58bd6d
to
a4487f8
Compare
a4487f8
to
942ab47
Compare
1f2ed6a
to
c78d252
Compare
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.
Minor question but LGTM otherwise!
2729488
to
79a6d0c
Compare
Rebased to get |
79a6d0c
to
2be52e1
Compare
Update to containerd 1.7 and move to `google.golang.org/protobuf` from `github.com/gogo/protobuf/gogoproto`. These two changes are intertwined, since containerd 1.7 changes its ttrpc task server definitions and protobuff generation (as well as some other API changes). Additionally, the task server gRPC code is imported from containerd directly, rather than being generated here, and that code now explicitly imports `google.golang.org/protobuf` instead of `github.com/gogo/protobuf/gogoproto`. Upgrading to `google.golang.org/protobuf` also requires updating the `containerd/cgroups` dependency to v3 (`github.com/containerd/cgroups/v3/cgroup1/stats/`). The new `protoc-gen-go-grpc` generators do not allow directives such as `gogoproto.customname`, so the `go-fix-acronym` command is used to update acronym customization (which is what containerd does). Updated `Protobuild.toml` to specify new generators. Added an `Update-Proto.ps1` script to re-generate protobuf files locally and in GitHub CI. Add `protobuild` and protobuff `grpc` and `ttrpc` generators to `tools.go` so they are tracked and vendored, and can be trivially installed via `go install`. Signed-off-by: Hamza El-Saawy <hamzaelsaawy@microsoft.com>
Signed-off-by: Hamza El-Saawy <hamzaelsaawy@microsoft.com>
2be52e1
to
f60f498
Compare
* Update containerd1.7; google.golang.org/protobuf Update to containerd 1.7 and move to `google.golang.org/protobuf` from `github.com/gogo/protobuf/gogoproto`. These two changes are intertwined, since containerd 1.7 changes its ttrpc task server definitions and protobuff generation (as well as some other API changes). Additionally, the task server gRPC code is imported from containerd directly, rather than being generated here, and that code now explicitly imports `google.golang.org/protobuf` instead of `github.com/gogo/protobuf/gogoproto`. Upgrading to `google.golang.org/protobuf` also requires updating the `containerd/cgroups` dependency to v3 (`github.com/containerd/cgroups/v3/cgroup1/stats/`). The new `protoc-gen-go-grpc` generators do not allow directives such as `gogoproto.customname`, so the `go-fix-acronym` command is used to update acronym customization (which is what containerd does). Updated `Protobuild.toml` to specify new generators. Added an `Update-Proto.ps1` script to re-generate protobuf files locally and in GitHub CI. Add `protobuild` and protobuff `grpc` and `ttrpc` generators to `tools.go` so they are tracked and vendored, and can be trivially installed via `go install`. Signed-off-by: Hamza El-Saawy <hamzaelsaawy@microsoft.com> * Vendor protobuf import changes Signed-off-by: Hamza El-Saawy <hamzaelsaawy@microsoft.com> --------- Signed-off-by: Hamza El-Saawy <hamzaelsaawy@microsoft.com>
Update to containerd 1.7 and move to
google.golang.org/protobuf
fromgh.neting.cc/gogo/protobuf/gogoproto
.Changes are broken out in two commits: second commit has vendor updates, so they don't clog reviewing the original change
These two changes are intertwined, since containerd 1.7 moves and changes its ttrpc task server definitions (containerd/containerd#6827) and protobuff generation (containerd/containerd#6841), as well as some other API changes.
Containerd updated to
"github.com/containerd/typeurl/v2"
, so now the types it registers by default (in"github.com/containerd/containerd/runtime"
'sinit
) are not available to the shim code unless the hcsshim repo either (1) switches totypeurl/v2
or (2) duplicates the containerd typerurl registration code.Since 1.7 does not use gogoproto, all references to it (eg
"github.com/gogo/protobuf/types".Empty
) have to be updated.Upgrading to
google.golang.org/protobuf
also requires updating thecontainerd/cgroups
dependency to v3(
github.com/containerd/cgroups/v3/cgroup1/stats/
), since the older v1 still uses gogoproto.Additionally, the containerd
protoc-gen-gogoctrd
is now deprecated and not included in containerd 1.7, so that generator is removed.The changes could be isolated, so only
./cmd/containerd-shim-runhcs-v1
(and internal code it relies on) that implements the containerd task server and interfaces with containerd is updated.However, this would result in bifurcating the project in two, with parts of the code base using the deprecated protobuf packages and marshalling, and requiring two different protobuf generation procedures (including cloning containerd 1.6 to use the now-deprecated
protoc-gen-gogoctrd
generator).This would likely add more work and complicate project management.
It is also not guaranteed that there would be a clean split between all the code, as there is likely shared code that would need to be updated to either use the new protobuf type (
"google.golang.org/protobuf/types/known/emptypb",
"google.golang.org/protobuf/types/known/timestamppb", and co) or keep the old types from "github.com/gogo/protobuf/types"The
protoc-gen-go-grpc
generator do not allow directives such asgogoproto.customname
, so thego-fix-acronym
command is used to update acronym customization (similar to what containerd does).Added
protobuild
and protobufgrpc
andttrpc
generators totools.go
so they are tracked and vendored, and can be trivially installed viago install
.Added an
Update-Proto.ps1
script to re-gerenate protobuf files locally and in GitHub CI.