Skip to content

Commit

Permalink
trivial. update go.mod for tks-common
Browse files Browse the repository at this point in the history
  • Loading branch information
ktkfree committed Mar 21, 2022
1 parent 10aaddb commit efa70c7
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 19 deletions.
1 change: 0 additions & 1 deletion cmd/server/handlers.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import (
pb "github.com/openinfradev/tks-proto/tks_pb"
)


func validateCreateClusterRequest(in *pb.CreateClusterRequest) (err error) {
if _, err := uuid.Parse(in.GetContractId()); err != nil {
return fmt.Errorf("invalid contract ID %s", in.GetContractId())
Expand Down
29 changes: 13 additions & 16 deletions cmd/server/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,11 @@ import (
"flag"
"os"

"github.com/openinfradev/tks-common/pkg/log"
"github.com/openinfradev/tks-common/pkg/argowf"
"github.com/openinfradev/tks-common/pkg/grpc_client"
"github.com/openinfradev/tks-common/pkg/grpc_server"
"github.com/openinfradev/tks-common/pkg/log"
pb "github.com/openinfradev/tks-proto/tks_pb"

)

type server struct {
Expand All @@ -24,13 +23,12 @@ var (
appInfoClient pb.AppInfoServiceClient
)


var (
port int
tls bool
tlsClientCertPath string
tlsCertPath string
tlsKeyPath string
port int
tlsEnabled bool
tlsClientCertPath string
tlsCertPath string
tlsKeyPath string

contractAddress string
contractPort int
Expand All @@ -45,7 +43,7 @@ var (

func init() {
flag.IntVar(&port, "port", 9112, "service port")
flag.BoolVar(&tls, "tls", false, "enabled tls")
flag.BoolVar(&tlsEnabled, "tlsEnabled", false, "enabled tls")
flag.StringVar(&tlsClientCertPath, "tls-client-cert-path", "../../cert/tks-ca.crt", "path of ca cert file for tls")
flag.StringVar(&tlsCertPath, "tls-cert-path", "../../cert/tks-server.crt", "path of cert file for tls")
flag.StringVar(&tlsKeyPath, "tls-key-path", "../../cert/tks-server.key", "path of key file for tls")
Expand All @@ -65,7 +63,7 @@ func main() {
flag.Parse()

log.Info("*** Arguments *** ")
log.Info("tls : ", tls)
log.Info("tlsEnabled : ", tlsEnabled)
log.Info("tlsClientCertPath : ", tlsClientCertPath)
log.Info("tlsCertPath : ", tlsCertPath)
log.Info("tlsKeyPath : ", tlsKeyPath)
Expand All @@ -90,25 +88,24 @@ func main() {
log.Fatal("failed to create argowf client : ", err)
}

if _, contractClient, err = grpc_client.CreateContractClient(contractAddress, contractPort, tls, tlsClientCertPath); err != nil {
if _, contractClient, err = grpc_client.CreateContractClient(contractAddress, contractPort, tlsEnabled, tlsClientCertPath); err != nil {
log.Fatal("failed to create contract client : ", err)
}

if _, cspInfoClient, err = grpc_client.CreateCspInfoClient(infoAddress, infoPort, tls, tlsClientCertPath); err != nil {
if _, cspInfoClient, err = grpc_client.CreateCspInfoClient(infoAddress, infoPort, tlsEnabled, tlsClientCertPath); err != nil {
log.Fatal("failed to create cspinfo client : ", err)
}

if _, clusterInfoClient, err = grpc_client.CreateClusterInfoClient(infoAddress, infoPort, tls, tlsClientCertPath); err != nil {
if _, clusterInfoClient, err = grpc_client.CreateClusterInfoClient(infoAddress, infoPort, tlsEnabled, tlsClientCertPath); err != nil {
log.Fatal("failed to create cluster client : ", err)
}

if _, appInfoClient, err = grpc_client.CreateAppInfoClient(infoAddress, infoPort, tls, tlsClientCertPath); err != nil {
if _, appInfoClient, err = grpc_client.CreateAppInfoClient(infoAddress, infoPort, tlsEnabled, tlsClientCertPath); err != nil {
log.Fatal("failed to create appinfo client : ", err)
}


// start server
s, conn, err := grpc_server.CreateServer(port, tls, tlsCertPath, tlsKeyPath)
s, conn, err := grpc_server.CreateServer(port, tlsEnabled, tlsCertPath, tlsKeyPath)
if err != nil {
log.Fatal("failed to crate grpc_server : ", err)
}
Expand Down
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ require (
github.com/golang/mock v1.6.0
github.com/google/uuid v1.3.0
github.com/grpc-ecosystem/go-grpc-middleware v1.3.0 // indirect
github.com/openinfradev/tks-common v0.0.0-20220210005751-57d957152e7b
github.com/openinfradev/tks-common v0.0.0-20220321044608-105302d33457 // indirect
github.com/openinfradev/tks-proto v0.0.6-0.20220304011855-99ac351f420f
github.com/stretchr/testify v1.7.0
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519 // indirect
Expand All @@ -21,4 +21,4 @@ replace github.com/openinfradev/tks-cluster-lcm => ./
//replace github.com/openinfradev/tks-contract => ../tks-contract
//replace github.com/openinfradev/tks-proto => ../tks-proto
//replace github.com/openinfradev/tks-info => ../tks-info
//replace github.com/openinfradev/tks-common => ./tks-common
//replace github.com/openinfradev/tks-common => ../tks-common
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -796,6 +796,8 @@ github.com/opencontainers/runtime-spec v1.0.3-0.20210326190908-1c3f411f0417/go.m
github.com/opencontainers/selinux v1.10.0/go.mod h1:2i0OySw99QjzBBQByd1Gr9gSjvuho1lHsJxIJ3gGbJI=
github.com/openinfradev/tks-common v0.0.0-20220210005751-57d957152e7b h1:4qPjR/0PszGLtijvygdxZHgspydJbZWqaVJh3HPBL2o=
github.com/openinfradev/tks-common v0.0.0-20220210005751-57d957152e7b/go.mod h1:3d+gW0PPeBzEUtVRoupTTXAFlfdJLyHy2Lzlw4rcnOk=
github.com/openinfradev/tks-common v0.0.0-20220321044608-105302d33457 h1:yKhmkHl2qi2/pyNBST8zI8fpcjjcpTFzACBwtk2fjik=
github.com/openinfradev/tks-common v0.0.0-20220321044608-105302d33457/go.mod h1:3d+gW0PPeBzEUtVRoupTTXAFlfdJLyHy2Lzlw4rcnOk=
github.com/openinfradev/tks-proto v0.0.6-0.20211015003551-ed8f9541f40d/go.mod h1:ul6kvgOXhNQvXEUmb92Wh5BmsuzknnTCb3wqmVNd/iI=
github.com/openinfradev/tks-proto v0.0.6-0.20220303062814-76fc7da4d48b h1:EIwM6iUC+9KCu+mbRtOH/c70ePvPJQ8p0NVt9OiGMEY=
github.com/openinfradev/tks-proto v0.0.6-0.20220303062814-76fc7da4d48b/go.mod h1:ul6kvgOXhNQvXEUmb92Wh5BmsuzknnTCb3wqmVNd/iI=
Expand Down

0 comments on commit efa70c7

Please sign in to comment.