[YUNIKORN-488] update protobuf and protoc (#37)
Update protoc to a current version (3.16)
Change to apiv2 for protobuf: google.golang.org/protobuf
Fixes: #37
diff --git a/Makefile b/Makefile
index 28ec633..cdf14d5 100644
--- a/Makefile
+++ b/Makefile
@@ -36,9 +36,9 @@
# Retrieve the protobuf version defined in the go module, and download the same version of binary for the build
# This variable will be exported and accessed from lib/go/Makefile
-PROTOBUF_VERSION := $(shell go list -m 'github.com/golang/protobuf' | cut -d' ' -f 2)
+PROTOBUF_VERSION := $(shell go list -m 'google.golang.org/protobuf' | cut -d' ' -f 2)
ifndef PROTOBUF_VERSION
-$(error Build requires to set a proper version of github.com/golang/protobuf in go.mod file)
+$(error Build requires to set a proper version of google.golang.org/protobuf in go.mod file)
endif
export PROTOBUF_VERSION
diff --git a/go.mod b/go.mod
index 1179dd5..d33386c 100644
--- a/go.mod
+++ b/go.mod
@@ -22,9 +22,7 @@
go 1.12
require (
- github.com/golang/protobuf v1.3.2
- golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3 // indirect
- golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135 // indirect
+ github.com/golang/protobuf v1.5.0
google.golang.org/grpc v1.26.0
- honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc // indirect
+ google.golang.org/protobuf v1.26.0 // indirect
)
diff --git a/go.sum b/go.sum
index 8aa6e46..c0c9f0c 100644
--- a/go.sum
+++ b/go.sum
@@ -8,11 +8,13 @@
github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q=
github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A=
github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
-github.com/golang/protobuf v1.3.1 h1:YF8+flBXS5eO826T4nzqPrxfhQThhXl0YzfuUPu4SBg=
-github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
github.com/golang/protobuf v1.3.2 h1:6nsPYzhq5kReh6QImI3k5qWzO4PEbvbIW2cwSfR/6xs=
github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
+github.com/golang/protobuf v1.5.0 h1:LUVKkCeviFUMKqHa4tXIIij/lbhnMbP7Fn5wKdKkRh4=
+github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk=
github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M=
+github.com/google/go-cmp v0.5.5 h1:Khx7svrCpmxxtHBq5j2mp/xVjsi8hQMfNLvJFAlrGgU=
+github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
@@ -37,6 +39,8 @@
golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY=
golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q=
+golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4=
+golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM=
google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4=
google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8 h1:Nw54tB0rB7hY/N0NQvRW8DG4Yk3Q6T9cu9RcFQDu1tc=
@@ -44,10 +48,11 @@
google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55 h1:gSJIx1SDwno+2ElGhA4+qG2zF97qiUzTM+rQ0klBOcE=
google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc=
google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c=
-google.golang.org/grpc v1.21.1 h1:j6XxA85m/6txkUCHvzlV5f+HBNl/1r5cZ2A/3IEFOO8=
-google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM=
google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg=
google.golang.org/grpc v1.26.0 h1:2dTRdpdFEEhJYQD8EMLB61nnrzSCTbG38PhqdhvOltg=
google.golang.org/grpc v1.26.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk=
+google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw=
+google.golang.org/protobuf v1.26.0 h1:bxAC2xTBsZGibn2RTntX0oH50xLsqy1OxA9tTL3p/lk=
+google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc=
honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
diff --git a/lib/go/Makefile b/lib/go/Makefile
index f50df02..ab9585b 100644
--- a/lib/go/Makefile
+++ b/lib/go/Makefile
@@ -35,19 +35,22 @@
# Only set PROTOC_VER if it has an empty value.
ifeq (,$(strip $(PROTOC_VER)))
-PROTOC_VER := 3.5.1
+PROTOC_VER := 3.16
endif
# Fix OS string for Mac builds.
PROTOC_OS := $(shell uname -s)
+PROTOGEN_OS := $(shell uname -s)
ifeq (Darwin,$(PROTOC_OS))
PROTOC_OS := osx
endif
# Allow building on 32 bit machines.
PROTOC_ARCH := $(shell uname -m)
+PROTOGEN_ARCH := amd64 #or 386 for 32 bits
ifeq (i386,$(PROTOC_ARCH))
PROTOC_ARCH := x86_32
+PROTOGEN_ARCH := 386
endif
# Get and install the protoc binary.
@@ -64,21 +67,15 @@
stat $@ > /dev/null 2>&1
# Get and install the go plug-in for protoc.
-GIT_NO_ADVICE := "-c advice.detachedHead=false"
-PROTOBUF_PKG := github.com/golang/protobuf
-PROTOC_GEN_GO := protoc-gen-go
-PROTOC_GEN_GO_PKG := $(PROTOBUF_PKG)/$(PROTOC_GEN_GO)
-PROTOC_GEN_GO_SRC := src
-$(PROTOC_GEN_GO):
- mkdir -p $(dir $(PROTOC_GEN_GO_SRC)/$(PROTOBUF_PKG))
- test -d $(PROTOC_GEN_GO_SRC)/$(PROTOBUF_PKG)/.git || \
- git clone $(GIT_NO_ADVICE) -b $(PROTOBUF_VERSION) --depth 1 https://$(PROTOBUF_PKG) $(PROTOC_GEN_GO_SRC)/$(PROTOBUF_PKG)
- (cd $(PROTOC_GEN_GO_SRC)/$(PROTOBUF_PKG) && \
- (test "$$(git describe --tags | head -1)" = "$(PROTOBUF_VERSION)" || \
- (rm -rf .??* * && git clone $(GIT_NO_ADVICE) -b $(PROTOBUF_VERSION) --depth 1 https://$(PROTOBUF_PKG) .)))
- (cd $(PROTOC_GEN_GO_SRC)/$(PROTOBUF_PKG) && \
- go get -v -d $$(go list -f '{{ .ImportPath }}' ./...)) && \
- go build -o $(PROTOC_BIN_DIR)/$@ $(PROTOC_GEN_GO_PKG)
+PROTO_GEN_GO_TAR := protoc-gen-go.$(PROTOBUF_VERSION).$(PROTOGEN_OS).$(PROTOGEN_ARCH).tar.gz
+PROTO_GEN_URL := https://github.com/protocolbuffers/protobuf-go/releases/download/$(PROTOBUF_VERSION)/$(PROTO_GEN_GO_TAR)
+PROTO_GEN_GO := $(PROTO_BIN_DIR)/protoc-gen-go
+$(PROTO_GEN_GO):
+ mkdir -p $(PROTO_TMP_DIR) && \
+ curl -L $(PROTO_GEN_URL) -o $(PROTO_TMP_DIR)/$(PROTO_GEN_GO_TAR) && \
+ tar -C $(PROTOC_BIN_DIR) -xzvf $(PROTO_TMP_DIR)/$(PROTO_GEN_GO_TAR) protoc-gen-go && \
+ chmod 0755 $(PROTO_GEN_GO)
+ stat $@ > /dev/null 2>&1
# Update PATH with the protoc bin dir which contains protoc and its plug-in
export PATH := $(HERE)/$(PROTOC_BIN_DIR):$(PATH)
diff --git a/lib/go/api/interface.go b/lib/go/api/interface.go
index 02494b7..be2769b 100644
--- a/lib/go/api/interface.go
+++ b/lib/go/api/interface.go
@@ -21,15 +21,15 @@
import "github.com/apache/incubator-yunikorn-scheduler-interface/lib/go/si"
type SchedulerAPI interface {
- // Register a new RM, if it is a reconnect from previous RM, cleanup
- // all in-memory data and resync with RM.
+ // Register a new RM, if it is a reconnect from previous RM, cleanup
+ // all in-memory data and resync with RM.
RegisterResourceManager(request *si.RegisterResourceManagerRequest, callback ResourceManagerCallback) (*si.RegisterResourceManagerResponse, error)
- // Update Scheduler status (including node status update, allocation request
- // updates, etc.
+ // Update Scheduler status (including node status update, allocation request
+ // updates, etc.
Update(request *si.UpdateRequest) error
- // Notify scheduler to reload configuration and hot-refresh in-memory state based on configuration changes
+ // Notify scheduler to reload configuration and hot-refresh in-memory state based on configuration changes
ReloadConfiguration(clusterID string) error
}