Skip to content

Commit

Permalink
Merge pull request #662 from jihoon-seo/210806_Add_call-DF-via-gRPC_c…
Browse files Browse the repository at this point in the history
…odes

Add call-DF-via-gRPC codes
  • Loading branch information
seokho-son authored Aug 11, 2021
2 parents 20a5bed + 2c15556 commit a24db83
Show file tree
Hide file tree
Showing 8 changed files with 752 additions and 97 deletions.
1 change: 1 addition & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ ENV CBTUMBLEBUG_ROOT /app
ENV CBSTORE_ROOT /app
ENV CBLOG_ROOT /app
ENV SPIDER_CALL_METHOD REST
ENV DRAGONFLY_CALL_METHOD REST
ENV SPIDER_REST_URL http://cb-spider:1024/spider
ENV DRAGONFLY_REST_URL http://cb-dragonfly:9090/dragonfly

Expand Down
13 changes: 13 additions & 0 deletions conf/grpc_conf.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,16 @@ grpc:
endpoint: localhost:6832
service_name: spider grpc client for tumblebug
sample_rate: 1
# dragonflycli:
# server_addr: 127.0.0.1:9999
# timeout: 90s
# # tls:
# # tls_ca: $CBTUMBLEBUG_ROOT/certs/ca.crt
# interceptors:
# # auth_jwt:
# # jwt_token: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJjbGllbnRJUCI6IjEyNy4wLjAuMSIsImV4cGlyZSI6MTkwODMyNTY1OCwib3JnTmFtZSI6IkVUUkkiLCJ1c2VyTmFtZSI6IkhvbmdHaWxEb25nIn0.4lkjYduo8iwv4AcKH96MpTnk8d7HRhi_p1xlnvZts8A
# opentracing:
# jaeger:
# endpoint: localhost:6832
# service_name: dragonfly grpc client for tumblebug
# sample_rate: 1
1 change: 1 addition & 0 deletions conf/setup.env
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ export CBTUMBLEBUG_ROOT=$HOME/go/src/github.com/cloud-barista/cb-tumblebug
export CBSTORE_ROOT=$CBTUMBLEBUG_ROOT
export CBLOG_ROOT=$CBTUMBLEBUG_ROOT
export SPIDER_CALL_METHOD=REST
export DRAGONFLY_CALL_METHOD=REST
export SPIDER_REST_URL=http://localhost:1024/spider
export DRAGONFLY_REST_URL=http://localhost:9090/dragonfly

Expand Down
10 changes: 1 addition & 9 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ require (
github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751
github.com/beego/beego/v2 v2.0.1
github.com/bramvdbogaerde/go-scp v1.0.0
github.com/cloud-barista/cb-dragonfly v0.4.1
github.com/cloud-barista/cb-log v0.4.0
github.com/cloud-barista/cb-spider v0.4.5
github.com/cloud-barista/cb-store v0.4.1
github.com/coreos/bbolt v1.3.4 // indirect
github.com/go-openapi/jsonreference v0.19.6 // indirect
github.com/go-openapi/spec v0.20.3 // indirect
github.com/go-openapi/swag v0.19.15 // indirect
Expand All @@ -25,36 +25,28 @@ require (
github.com/golang-jwt/jwt/v4 v4.0.0
github.com/golang/protobuf v1.5.2
github.com/google/uuid v1.3.0
github.com/gopherjs/gopherjs v0.0.0-20200217142428-fce0ec30dd00 // indirect
github.com/grpc-ecosystem/go-grpc-middleware v1.3.0
github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0
github.com/jonboulle/clockwork v0.2.2 // indirect
github.com/labstack/echo/v4 v4.3.0
github.com/mailru/easyjson v0.7.7 // indirect
github.com/mattn/go-isatty v0.0.13 // indirect
github.com/mattn/go-sqlite3 v2.0.3+incompatible
github.com/opentracing/opentracing-go v1.2.0
github.com/prometheus/client_golang v1.11.0
github.com/prometheus/common v0.29.0 // indirect
github.com/shiena/ansicolor v0.0.0-20200904210342-c7312218db18 // indirect
github.com/sirupsen/logrus v1.8.1
github.com/smartystreets/assertions v1.1.0 // indirect
github.com/spf13/cobra v1.2.1
github.com/spf13/viper v1.8.1
github.com/stretchr/objx v0.2.0 // indirect
github.com/stretchr/testify v1.7.0
github.com/swaggo/echo-swagger v1.1.0
github.com/swaggo/swag v1.7.0
github.com/tidwall/gjson v1.8.0
github.com/tidwall/pretty v1.2.0 // indirect
github.com/tidwall/sjson v1.1.7
github.com/tmc/grpc-websocket-proxy v0.0.0-20200427203606-3cfed13b9966 // indirect
github.com/uber/jaeger-client-go v2.29.1+incompatible
github.com/uber/jaeger-lib v2.4.1+incompatible // indirect
golang.org/x/crypto v0.0.0-20210711020723-a769d52b0f97
golang.org/x/time v0.0.0-20210611083556-38a9dc6acbc6 // indirect
google.golang.org/grpc v1.39.0
gopkg.in/yaml.v2 v2.4.0
sigs.k8s.io/yaml v1.2.0 // indirect
xorm.io/xorm v1.1.2
)
556 changes: 556 additions & 0 deletions go.sum

Large diffs are not rendered by default.

33 changes: 23 additions & 10 deletions src/api/grpc/cbadm/grpc_conf.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
version: 1
grpc:
tumblebugcli:
server_addr: 127.0.0.1:50252
timeout: 500s
spidercli:
server_addr: 127.0.0.1:2048
timeout: 90s
#tls:
# tls_ca: $CBTUMBLEBUG_ROOT/certs/ca.crt
interceptors:
Expand All @@ -11,11 +11,11 @@ grpc:
opentracing:
jaeger:
endpoint: localhost:6832
service_name: tumblebug grpc client
sample_rate: 1
spidercli:
server_addr: 127.0.0.1:2048
timeout: 90s
service_name: spider grpc client
sample_rate: 1
tumblebugcli:
server_addr: 127.0.0.1:50252
timeout: 500s
#tls:
# tls_ca: $CBTUMBLEBUG_ROOT/certs/ca.crt
interceptors:
Expand All @@ -24,5 +24,18 @@ grpc:
opentracing:
jaeger:
endpoint: localhost:6832
service_name: spider grpc client
sample_rate: 1
service_name: tumblebug grpc client
sample_rate: 1
# dragonflycli:
# server_addr: 127.0.0.1:9999
# timeout: 90s
# # tls:
# # tls_ca: $CBTUMBLEBUG_ROOT/certs/ca.crt
# interceptors:
# # auth_jwt:
# # jwt_token: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJjbGllbnRJUCI6IjEyNy4wLjAuMSIsImV4cGlyZSI6MTkwODMyNTY1OCwib3JnTmFtZSI6IkVUUkkiLCJ1c2VyTmFtZSI6IkhvbmdHaWxEb25nIn0.4lkjYduo8iwv4AcKH96MpTnk8d7HRhi_p1xlnvZts8A
# opentracing:
# jaeger:
# endpoint: localhost:6832
# service_name: dragonfly grpc client
# sample_rate: 1
70 changes: 51 additions & 19 deletions src/api/grpc/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,9 @@ type GrpcConfig struct {
// GrpcServiceList - CB-GRPC 서비스 목록
type GrpcServiceList struct {
TumblebugSrv *GrpcServerConfig `mapstructure:"tumblebugsrv"`
TumblebugCli *GrpcClientConfig `mapstructure:"tumblebugcli"`
SpiderCli *GrpcClientConfig `mapstructure:"spidercli"`
TumblebugCli *GrpcClientConfig `mapstructure:"tumblebugcli"`
// DragonflyCli *GrpcClientConfig `mapstructure:"dragonflycli"`
}

// GrpcServerConfig - CB-GRPC 서버 설정 구조
Expand Down Expand Up @@ -138,6 +139,35 @@ func (gConf *GrpcConfig) initGlobalParams() {
}
}

if gConf.GSL.SpiderCli != nil {

if gConf.GSL.SpiderCli.Timeout == 0 {
gConf.GSL.SpiderCli.Timeout = 90 * time.Second
}

if gConf.GSL.SpiderCli.TLS != nil {
if gConf.GSL.SpiderCli.TLS.TLSCA != "" {
gConf.GSL.SpiderCli.TLS.TLSCA = ReplaceEnvPath(gConf.GSL.SpiderCli.TLS.TLSCA)
}
}

if gConf.GSL.SpiderCli.Interceptors != nil {
if gConf.GSL.SpiderCli.Interceptors.Opentracing != nil {
if gConf.GSL.SpiderCli.Interceptors.Opentracing.Jaeger != nil {

if gConf.GSL.SpiderCli.Interceptors.Opentracing.Jaeger.ServiceName == "" {
gConf.GSL.SpiderCli.Interceptors.Opentracing.Jaeger.ServiceName = "spider grpc client"
}

if gConf.GSL.SpiderCli.Interceptors.Opentracing.Jaeger.SampleRate == 0 {
gConf.GSL.SpiderCli.Interceptors.Opentracing.Jaeger.SampleRate = 1
}

}
}
}
}

if gConf.GSL.TumblebugCli != nil {

if gConf.GSL.TumblebugCli.Timeout == 0 {
Expand Down Expand Up @@ -167,34 +197,36 @@ func (gConf *GrpcConfig) initGlobalParams() {
}
}

if gConf.GSL.SpiderCli != nil {
/*
if gConf.GSL.DragonflyCli != nil {
if gConf.GSL.SpiderCli.Timeout == 0 {
gConf.GSL.SpiderCli.Timeout = 90 * time.Second
}
if gConf.GSL.DragonflyCli.Timeout == 0 {
gConf.GSL.DragonflyCli.Timeout = 90 * time.Second
}
if gConf.GSL.SpiderCli.TLS != nil {
if gConf.GSL.SpiderCli.TLS.TLSCA != "" {
gConf.GSL.SpiderCli.TLS.TLSCA = ReplaceEnvPath(gConf.GSL.SpiderCli.TLS.TLSCA)
if gConf.GSL.DragonflyCli.TLS != nil {
if gConf.GSL.DragonflyCli.TLS.TLSCA != "" {
gConf.GSL.DragonflyCli.TLS.TLSCA = ReplaceEnvPath(gConf.GSL.DragonflyCli.TLS.TLSCA)
}
}
}
if gConf.GSL.SpiderCli.Interceptors != nil {
if gConf.GSL.SpiderCli.Interceptors.Opentracing != nil {
if gConf.GSL.SpiderCli.Interceptors.Opentracing.Jaeger != nil {
if gConf.GSL.DragonflyCli.Interceptors != nil {
if gConf.GSL.DragonflyCli.Interceptors.Opentracing != nil {
if gConf.GSL.DragonflyCli.Interceptors.Opentracing.Jaeger != nil {
if gConf.GSL.SpiderCli.Interceptors.Opentracing.Jaeger.ServiceName == "" {
gConf.GSL.SpiderCli.Interceptors.Opentracing.Jaeger.ServiceName = "grpc spider client"
}
if gConf.GSL.DragonflyCli.Interceptors.Opentracing.Jaeger.ServiceName == "" {
gConf.GSL.DragonflyCli.Interceptors.Opentracing.Jaeger.ServiceName = "dragonfly grpc client"
}
if gConf.GSL.SpiderCli.Interceptors.Opentracing.Jaeger.SampleRate == 0 {
gConf.GSL.SpiderCli.Interceptors.Opentracing.Jaeger.SampleRate = 1
}
if gConf.GSL.DragonflyCli.Interceptors.Opentracing.Jaeger.SampleRate == 0 {
gConf.GSL.DragonflyCli.Interceptors.Opentracing.Jaeger.SampleRate = 1
}
}
}
}
}
}
*/

}

Expand Down
Loading

0 comments on commit a24db83

Please sign in to comment.