CRI: use more gogoprotobuf plugins

This includes generating marshaler/unmarshaler code to improve
performance.
This commit is contained in:
Yu-Ju Hong 2017-01-24 17:53:28 -08:00
parent ee94968f94
commit 760d8e98e8
4 changed files with 16967 additions and 390 deletions

View File

@ -29,7 +29,7 @@ BINS=(
)
make -C "${KUBE_ROOT}" WHAT="${BINS[*]}"
if [[ -z "$(which protoc)" || "$(protoc --version)" != "libprotoc 3.0."* ]]; then
if [[ -z "$(which protoc)" || "$(protoc --version)" != "libprotoc 3."* ]]; then
echo "Generating protobuf requires protoc 3.0.0-beta1 or newer. Please download and"
echo "install the platform appropriate Protobuf package for your OS: "
echo
@ -46,8 +46,17 @@ function cleanup {
trap cleanup EXIT
gogopath=$(dirname $(kube::util::find-binary "protoc-gen-gogo"))
export PATH=$gogopath:$PATH
protoc -I${KUBE_REMOTE_RUNTIME_ROOT} --gogo_out=plugins=grpc:${KUBE_REMOTE_RUNTIME_ROOT} ${KUBE_REMOTE_RUNTIME_ROOT}/api.proto
PATH="${gogopath}:${PATH}" \
protoc \
--proto_path="${KUBE_REMOTE_RUNTIME_ROOT}" \
--proto_path="${KUBE_ROOT}/vendor" \
--gogo_out=plugins=grpc:${KUBE_REMOTE_RUNTIME_ROOT} ${KUBE_REMOTE_RUNTIME_ROOT}/api.proto
# Update boilerplate for the generated file.
echo "$(cat hack/boilerplate/boilerplate.go.txt ${KUBE_REMOTE_RUNTIME_ROOT}/api.pb.go)" > ${KUBE_REMOTE_RUNTIME_ROOT}/api.pb.go
sed -i".bak" "s/Copyright YEAR/Copyright $(date '+%Y')/g" ${KUBE_REMOTE_RUNTIME_ROOT}/api.pb.go
# Run gofmt to clean up the generated code.
kube::golang::verify_go_version
gofmt -l -s -w ${KUBE_REMOTE_RUNTIME_ROOT}/api.pb.go

View File

@ -15,7 +15,9 @@ go_library(
],
tags = ["automanaged"],
deps = [
"//vendor:github.com/gogo/protobuf/gogoproto",
"//vendor:github.com/gogo/protobuf/proto",
"//vendor:github.com/gogo/protobuf/sortkeys",
"//vendor:golang.org/x/net/context",
"//vendor:google.golang.org/grpc",
],

File diff suppressed because it is too large Load Diff

View File

@ -3,6 +3,16 @@ syntax = 'proto3';
package runtime;
import "github.com/gogo/protobuf/gogoproto/gogo.proto";
option (gogoproto.goproto_stringer_all) = false;
option (gogoproto.stringer_all) = true;
option (gogoproto.goproto_getters_all) = true;
option (gogoproto.marshaler_all) = true;
option (gogoproto.sizer_all) = true;
option (gogoproto.unmarshaler_all) = true;
option (gogoproto.goproto_unrecognized_all) = false;
// Runtime service defines the public APIs for remote container runtimes
service RuntimeService {
// Version returns the runtime name, runtime version, and runtime API version.