mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-25 04:33:26 +00:00
CRI: use more gogoprotobuf plugins
This includes generating marshaler/unmarshaler code to improve performance.
This commit is contained in:
parent
ee94968f94
commit
760d8e98e8
@ -29,7 +29,7 @@ BINS=(
|
|||||||
)
|
)
|
||||||
make -C "${KUBE_ROOT}" WHAT="${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 "Generating protobuf requires protoc 3.0.0-beta1 or newer. Please download and"
|
||||||
echo "install the platform appropriate Protobuf package for your OS: "
|
echo "install the platform appropriate Protobuf package for your OS: "
|
||||||
echo
|
echo
|
||||||
@ -46,8 +46,17 @@ function cleanup {
|
|||||||
trap cleanup EXIT
|
trap cleanup EXIT
|
||||||
|
|
||||||
gogopath=$(dirname $(kube::util::find-binary "protoc-gen-gogo"))
|
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
|
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
|
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
|
||||||
|
@ -15,7 +15,9 @@ go_library(
|
|||||||
],
|
],
|
||||||
tags = ["automanaged"],
|
tags = ["automanaged"],
|
||||||
deps = [
|
deps = [
|
||||||
|
"//vendor:github.com/gogo/protobuf/gogoproto",
|
||||||
"//vendor:github.com/gogo/protobuf/proto",
|
"//vendor:github.com/gogo/protobuf/proto",
|
||||||
|
"//vendor:github.com/gogo/protobuf/sortkeys",
|
||||||
"//vendor:golang.org/x/net/context",
|
"//vendor:golang.org/x/net/context",
|
||||||
"//vendor:google.golang.org/grpc",
|
"//vendor:google.golang.org/grpc",
|
||||||
],
|
],
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -3,6 +3,16 @@ syntax = 'proto3';
|
|||||||
|
|
||||||
package runtime;
|
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
|
// Runtime service defines the public APIs for remote container runtimes
|
||||||
service RuntimeService {
|
service RuntimeService {
|
||||||
// Version returns the runtime name, runtime version, and runtime API version.
|
// Version returns the runtime name, runtime version, and runtime API version.
|
||||||
|
Loading…
Reference in New Issue
Block a user