Skip to content
Snippets Groups Projects
Commit 0a4126d0 authored by Neil-Jocelyn Schark's avatar Neil-Jocelyn Schark
Browse files

Rework passthrough flag

See merge request !904
parent dd13e164
No related branches found
No related tags found
1 merge request!904Rework passthrough flag
Pipeline #202217 passed
...@@ -46,7 +46,7 @@ import ( ...@@ -46,7 +46,7 @@ import (
var cfgFile string var cfgFile string
var verbose bool var verbose bool
var gRPCPassthrough bool var noGRPCPassthrough bool
var loglevel string var loglevel string
var grpcPort string var grpcPort string
var cliPnd string var cliPnd string
...@@ -87,7 +87,7 @@ func init() { ...@@ -87,7 +87,7 @@ func init() {
rootCmd.PersistentFlags().StringVar(&cfgFile, "config", "", "config file (./.gosdnc.toml)") rootCmd.PersistentFlags().StringVar(&cfgFile, "config", "", "config file (./.gosdnc.toml)")
rootCmd.PersistentFlags().StringVarP(&loglevel, "log-level", "l", "", "log level 'debug' or 'trace'") rootCmd.PersistentFlags().StringVarP(&loglevel, "log-level", "l", "", "log level 'debug' or 'trace'")
rootCmd.PersistentFlags().BoolVar(&verbose, "verbose", false, "show mne and sbi info") rootCmd.PersistentFlags().BoolVar(&verbose, "verbose", false, "show mne and sbi info")
rootCmd.PersistentFlags().BoolVar(&gRPCPassthrough, "grpcPassthrough", true, "set the default resolve scheme for grpc to passthrough, default is true") rootCmd.PersistentFlags().BoolVar(&noGRPCPassthrough, "noGRPCPassthrough", true, "set the default resolve scheme for grpc to not use passthrough, default is false")
rootCmd.Flags().StringVar(&grpcPort, "grpc-port", "55055", "port for gRPC NBI") rootCmd.Flags().StringVar(&grpcPort, "grpc-port", "55055", "port for gRPC NBI")
} }
...@@ -150,11 +150,11 @@ func initConfig() { ...@@ -150,11 +150,11 @@ func initConfig() {
cliPnd = uuid.New().String() cliPnd = uuid.New().String()
} }
if gRPCPassthrough { if noGRPCPassthrough {
log.Info("gRPC default resolver scheme is not set to passthrough. This might cause issues with the gRPC connection when no real DNS server is available as each gRPC requests requires a DNS request.")
} else {
log.Info("Setting gRPC default resolver scheme to passthrough. No DNS queries are being made when doing a gRPC request.") log.Info("Setting gRPC default resolver scheme to passthrough. No DNS queries are being made when doing a gRPC request.")
resolver.SetDefaultScheme("passthrough") resolver.SetDefaultScheme("passthrough")
} else {
log.Info("gRPC default resolver scheme is not set to passthrough. This might cause issues with the gRPC connection when no real DNS server is available as each gRPC requests requires a DNS request.")
} }
adapter, err := adapter.NewPndAdapter(cliPnd, viper.GetString("controllerAPIEndpoint")) adapter, err := adapter.NewPndAdapter(cliPnd, viper.GetString("controllerAPIEndpoint"))
......
...@@ -52,7 +52,7 @@ var csbiOrchestrator string ...@@ -52,7 +52,7 @@ var csbiOrchestrator string
var pluginRegistry string var pluginRegistry string
var pluginFolder string var pluginFolder string
var security string var security string
var gRPCPassthrough bool var noGRPCPassthrough bool
// rootCmd represents the base command when called without any subcommands. // rootCmd represents the base command when called without any subcommands.
var rootCmd = &cobra.Command{ var rootCmd = &cobra.Command{
...@@ -87,7 +87,7 @@ func init() { ...@@ -87,7 +87,7 @@ func init() {
rootCmd.Flags().StringVar(&pluginRegistry, "plugin-registry", "", "plugin registry address") rootCmd.Flags().StringVar(&pluginRegistry, "plugin-registry", "", "plugin registry address")
rootCmd.Flags().StringVar(&pluginFolder, "plugin-folder", "", "folder holding all goSDN specific plugins") rootCmd.Flags().StringVar(&pluginFolder, "plugin-folder", "", "folder holding all goSDN specific plugins")
rootCmd.Flags().StringVarP(&security, "security", "s", "", "security level 'secure' or 'insecure'") rootCmd.Flags().StringVarP(&security, "security", "s", "", "security level 'secure' or 'insecure'")
rootCmd.Flags().BoolVar(&gRPCPassthrough, "grpcPassthrough", true, "set the default resolve scheme for grpc to passthrough, default is true") rootCmd.Flags().BoolVar(&noGRPCPassthrough, "noGRPCPassthrough", false, "set the default resolve scheme for grpc to not use passthrough, default is false")
} }
const ( const (
......
...@@ -202,12 +202,12 @@ func setupPluginRegistryClient() rpb.PluginRegistryServiceClient { ...@@ -202,12 +202,12 @@ func setupPluginRegistryClient() rpb.PluginRegistryServiceClient {
} }
func startGrpc() error { func startGrpc() error {
passthrough := viper.GetBool("passthrough") noPassthrough := viper.GetBool("noGRPCPassthrough")
if passthrough { if noPassthrough {
log.Info("gRPC default resolver scheme is not set to passthrough. This might cause issues with the gRPC connection when no real DNS server is available as each gRPC requests requires a DNS request.")
} else {
log.Info("Setting gRPC default resolver scheme to passthrough. No DNS queries are being made when doing a gRPC request.") log.Info("Setting gRPC default resolver scheme to passthrough. No DNS queries are being made when doing a gRPC request.")
resolver.SetDefaultScheme("passthrough") resolver.SetDefaultScheme("passthrough")
} else {
log.Info("gRPC default resolver scheme is not set to passthrough. This might cause issues with the gRPC connection when no real DNS server is available as each gRPC requests requires a DNS request.")
} }
socket := viper.GetString("socket") socket := viper.GetString("socket")
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment