updated dependencies

This commit is contained in:
marvzhang
2021-07-15 21:29:15 +08:00
parent 553fbbc1f8
commit db6414aa5b
5 changed files with 168 additions and 96 deletions

View File

@@ -12,6 +12,7 @@ var (
runOnMaster bool
masterConfigPath string
masterGrpcAddress string
masterGrpcAuthKey string
)
func init() {
@@ -22,6 +23,9 @@ func init() {
masterCmd.PersistentFlags().StringVarP(&masterGrpcAddress, "grpc-address", "g", "", "gRPC address of master node")
_ = viper.BindPFlag("grpcAddress", masterCmd.PersistentFlags().Lookup("grpcAddress"))
masterCmd.PersistentFlags().StringVarP(&masterGrpcAuthKey, "grpc-auth-key", "a", "", "gRPC auth key of master node")
_ = viper.BindPFlag("grpcAuthKey", masterCmd.PersistentFlags().Lookup("grpcAuthKey"))
}
var masterCmd = &cobra.Command{
@@ -47,6 +51,9 @@ which runs api and assign tasks to worker nodes`,
viper.Set("grpc.address", masterGrpcAddress)
viper.Set("grpc.server.address", masterGrpcAddress)
}
if masterGrpcAuthKey != "" {
viper.Set("grpc.authKey", masterGrpcAuthKey)
}
// app
master := apps.NewMaster(opts...)

View File

@@ -11,6 +11,7 @@ import (
var (
workerConfigPath string
workerGrpcAddress string
workerGrpcAuthKey string
)
func init() {
@@ -21,6 +22,9 @@ func init() {
workerCmd.PersistentFlags().StringVarP(&workerGrpcAddress, "grpc-address", "g", "", "gRPC address of worker node")
_ = viper.BindPFlag("grpcAddress", workerCmd.PersistentFlags().Lookup("grpcAddress"))
workerCmd.PersistentFlags().StringVarP(&workerGrpcAuthKey, "grpc-auth-key", "a", "", "gRPC auth key of worker node")
_ = viper.BindPFlag("grpcAuthKey", workerCmd.PersistentFlags().Lookup("grpcAuthKey"))
}
var workerCmd = &cobra.Command{
@@ -46,6 +50,9 @@ assigned by the master node`,
opts = append(opts, apps.WithWorkerGrpcAddress(address))
viper.Set("grpc.address", workerGrpcAddress)
}
if workerGrpcAuthKey != "" {
viper.Set("grpc.authKey", workerGrpcAuthKey)
}
// app
master := apps.NewWorker(opts...)