Skip to content

Commit

Permalink
run protoc-gen-go from vendor
Browse files Browse the repository at this point in the history
Signed-off-by: Zbynek Roubalik <[email protected]>
  • Loading branch information
zroubalik committed Nov 10, 2022
1 parent d424a98 commit 007b14f
Show file tree
Hide file tree
Showing 21 changed files with 5,566 additions and 260 deletions.
16 changes: 4 additions & 12 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ manifests: controller-gen ## Generate ClusterRole and CustomResourceDefinition o
# until this issue is fixed: https://github.com/kubernetes-sigs/controller-tools/issues/398
rm config/crd/bases/keda.sh_withtriggers.yaml

generate: controller-gen mockgen-gen ## Generate code containing DeepCopy, DeepCopyInto, DeepCopyObject method implementations (API) and mocks.
generate: controller-gen mockgen-gen proto-gen ## Generate code containing DeepCopy, DeepCopyInto, DeepCopyObject method implementations (API), mocks and proto.
$(CONTROLLER_GEN) object:headerFile="hack/boilerplate.go.txt" paths="./..."

adapter/generated/openapi/zz_generated.openapi.go: go.mod go.sum ## Generate OpenAPI for KEDA Metrics Adapter.
Expand Down Expand Up @@ -148,17 +148,9 @@ clientset-verify: ## Verify that generated client-go clientset, listers and info
clientset-generate: ## Generate client-go clientset, listers and informers.
./hack/update-codegen.sh

# Generate Liiklus proto
pkg/scalers/liiklus/LiiklusService.pb.go: protoc-gen-go
protoc --proto_path=hack LiiklusService.proto --go_out=pkg/scalers/liiklus --go-grpc_out=pkg/scalers/liiklus

# Generate ExternalScaler proto
pkg/scalers/externalscaler/externalscaler.pb.go: protoc-gen-go
protoc --proto_path=pkg/scalers/externalscaler externalscaler.proto --go-grpc_out=pkg/scalers/externalscaler

protoc-gen-go: ## Download protoc-gen-go
go install google.golang.org/protobuf/cmd/[email protected]
go install google.golang.org/grpc/cmd/[email protected]
proto-gen: ## Generate Liiklus, ExternalScaler and MetricsService proto
protoc -I vendor --proto_path=hack LiiklusService.proto --go_out=pkg/scalers/liiklus --go-grpc_out=pkg/scalers/liiklus
protoc -I vendor --proto_path=pkg/scalers/externalscaler externalscaler.proto --go_out=pkg/scalers/externalscaler --go-grpc_out=pkg/scalers/externalscaler

.PHONY: mockgen-gen
mockgen-gen: mockgen pkg/mock/mock_scaling/mock_interface.go pkg/mock/mock_scaler/mock_scaler.go pkg/mock/mock_scale/mock_interfaces.go pkg/mock/mock_client/mock_interfaces.go pkg/scalers/liiklus/mocks/mock_liiklus.go
Expand Down
1 change: 1 addition & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ require (
golang.org/x/oauth2 v0.1.0
google.golang.org/api v0.101.0
google.golang.org/grpc v1.50.1
google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.2.0
google.golang.org/protobuf v1.28.1
k8s.io/api v0.24.5
k8s.io/apimachinery v0.24.5
Expand Down
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -1455,6 +1455,8 @@ google.golang.org/grpc v1.40.0/go.mod h1:ogyxbiOoUXAkP+4+xa6PZSE9DZgIHtSpzjDTB9K
google.golang.org/grpc v1.42.0/go.mod h1:k+4IHHFw41K8+bbowsex27ge2rCb65oeWqe4jJ590SU=
google.golang.org/grpc v1.50.1 h1:DS/BukOZWp8s6p4Dt/tOaJaTQyPyOoCcrjroHuCeLzY=
google.golang.org/grpc v1.50.1/go.mod h1:ZgQEeidpAuNRZ8iRrlBKXZQP1ghovWIVhdJRyCDK+GI=
google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.2.0 h1:TLkBREm4nIsEcexnCjgQd5GQWaHcqMzwQV0TX9pq8S0=
google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.2.0/go.mod h1:DNq5QpG7LJqD2AamLZ7zvKE0DEpVl2BSEVjFycAAjRY=
google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8=
google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0=
google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM=
Expand Down
2 changes: 2 additions & 0 deletions hack/tools.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ package tools
import (
// Import code-generator to use in build tools
_ "github.com/golang/mock/mockgen"
_ "google.golang.org/grpc/cmd/protoc-gen-go-grpc"
_ "google.golang.org/protobuf/cmd/protoc-gen-go"
_ "k8s.io/code-generator"
_ "k8s.io/kube-openapi/cmd/openapi-gen"
_ "sigs.k8s.io/controller-runtime/tools/setup-envtest"
Expand Down
11 changes: 4 additions & 7 deletions pkg/scalers/external_scaler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,10 +110,10 @@ func createGRPCServers(count int, t *testing.T) []testServer {
address := fmt.Sprintf("127.0.0.1:%d", 5050+i)
lis, _ := net.Listen("tcp", address)
activeCh := make(chan bool)
pb.RegisterExternalScalerServer(grpcServer, &testExternalScaler{
pb.RegisterExternalScalerService(grpcServer, pb.NewExternalScalerService(&testExternalScaler{
t: t,
active: activeCh,
})
}))

go func() {
if err := grpcServer.Serve(lis); err != nil {
Expand Down Expand Up @@ -141,9 +141,6 @@ func createIsActiveChannels(count int) []chan bool {
}

type testExternalScaler struct {
// Embed the unimplemented server
pb.UnimplementedExternalScalerServer

t *testing.T
active chan bool
}
Expand Down Expand Up @@ -185,10 +182,10 @@ func TestWaitForState(t *testing.T) {
return
}
activeCh := make(chan bool)
pb.RegisterExternalScalerServer(grpcServer, &testExternalScaler{
pb.RegisterExternalScalerService(grpcServer, pb.NewExternalScalerService(&testExternalScaler{
t: t,
active: activeCh,
})
}))

go func() {
if err := grpcServer.Serve(lis); err != nil {
Expand Down
2 changes: 1 addition & 1 deletion pkg/scalers/externalscaler/externalscaler.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 007b14f

Please sign in to comment.