Skip to content

Commit

Permalink
Update gRPC codes
Browse files Browse the repository at this point in the history
  • Loading branch information
jihoon-seo committed Aug 11, 2021
1 parent 2e597f3 commit 2c15556
Show file tree
Hide file tree
Showing 4 changed files with 85 additions and 41 deletions.
20 changes: 10 additions & 10 deletions conf/grpc_conf.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,13 @@ grpc:
# 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: tumblebug grpc client
# sample_rate: 1
# # 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
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
3 changes: 1 addition & 2 deletions src/core/mcis/monitor.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import (

df_pb "github.com/cloud-barista/cb-dragonfly/pkg/api/grpc/protobuf/cbdragonfly"
df_api "github.com/cloud-barista/cb-dragonfly/pkg/api/grpc/request"

"github.com/cloud-barista/cb-tumblebug/src/core/common"
)

Expand Down Expand Up @@ -114,7 +115,6 @@ func CheckDragonflyEndpoint() error {
}
defer monApi.Close()

monApi = df_api.GetMonitoringAPI()
result, err := monApi.GetMonitoringConfig()
if err != nil {
return err
Expand Down Expand Up @@ -456,7 +456,6 @@ func CallGetMonitoringAsync(wg *sync.WaitGroup, nsID string, mcisID string, vmID
}
defer monApi.Close()

monApi = df_api.GetMonitoringAPI()
result, err := monApi.GetVMOnDemandMonInfo(metric, reqParams)
if err != nil {
common.CBLog.Error(err)
Expand Down

0 comments on commit 2c15556

Please sign in to comment.