Updated containerd1.7; google.golang.org/protobuf#1706
Updated containerd1.7; google.golang.org/protobuf#1706helsaawy merged 2 commits intomicrosoft:mainfrom
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 |
katiewasnothere
left a comment
There was a problem hiding this comment.
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
ambarve
left a comment
There was a problem hiding this comment.
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 <[email protected]>
Signed-off-by: Hamza El-Saawy <[email protected]>
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 <[email protected]> * Vendor protobuf import changes Signed-off-by: Hamza El-Saawy <[email protected]> --------- Signed-off-by: Hamza El-Saawy <[email protected]>
Update to containerd 1.7 and move to
google.golang.org/protobuffromgithub.com/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/v2or (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/protobufalso requires updating thecontainerd/cgroupsdependency to v3(
github.com/containerd/cgroups/v3/cgroup1/stats/), since the older v1 still uses gogoproto.Additionally, the containerd
protoc-gen-gogoctrdis 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-gogoctrdgenerator).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-grpcgenerator do not allow directives such asgogoproto.customname, so thego-fix-acronymcommand is used to update acronym customization (similar to what containerd does).Added
protobuildand protobufgrpcandttrpcgenerators totools.goso they are tracked and vendored, and can be trivially installed viago install.Added an
Update-Proto.ps1script to re-gerenate protobuf files locally and in GitHub CI.