Skip to content

Commit

Permalink
pkg/option: ignore warnings if flags are not set
Browse files Browse the repository at this point in the history
Signed-off-by: André Martins <andre@cilium.io>
  • Loading branch information
aanm committed Mar 12, 2020
1 parent 4ca3a03 commit 219b81f
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions pkg/option/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -2269,7 +2269,9 @@ func (c *DaemonConfig) populateNodePortRange() error {
return errors.New("NodePort range min port must be smaller than max port")
}
case 0:
log.Warning("NodePort range was set but is empty.")
if viper.IsSet(NodePortRange) {
log.Warning("NodePort range was set but is empty.")
}
default:
return fmt.Errorf("Unable to parse min/max port value for NodePort range: %s", NodePortRange)
}
Expand Down Expand Up @@ -2306,11 +2308,13 @@ func (c *DaemonConfig) populateHostServicesProtos() error {
func sanitizeIntParam(paramName string, paramDefault int) int {
intParam := viper.GetInt(paramName)
if intParam <= 0 {
log.WithFields(
logrus.Fields{
"parameter": paramName,
"defaultValue": paramDefault,
}).Warning("user-provided parameter had value <= 0 , which is invalid ; setting to default")
if !viper.IsSet(paramName) {
log.WithFields(
logrus.Fields{
"parameter": paramName,
"defaultValue": paramDefault,
}).Warning("user-provided parameter had value <= 0 , which is invalid ; setting to default")
}
return paramDefault
}
return intParam
Expand Down

0 comments on commit 219b81f

Please sign in to comment.