split secure serving options

This commit is contained in:
deads2k
2016-11-09 10:42:58 -05:00
parent a9af8206cb
commit a08f3ba521
8 changed files with 181 additions and 85 deletions

View File

@@ -51,19 +51,17 @@ func verifyServiceNodePort(options *options.ServerRunOptions) []error {
func verifySecureAndInsecurePort(options *options.ServerRunOptions) []error {
errors := []error{}
if options.SecurePort < 0 || options.SecurePort > 65535 {
errors = append(errors, fmt.Errorf("--secure-port %v must be between 0 and 65535, inclusive. 0 for turning off secure port.", options.SecurePort))
}
errors = append(errors, options.SecureServingOptions.Validate()...)
if options.InsecurePort < 0 || options.InsecurePort > 65535 {
errors = append(errors, fmt.Errorf("--insecure-port %v must be between 0 and 65535, inclusive. 0 for turning off insecure port.", options.InsecurePort))
}
if options.SecurePort == 0 && options.InsecurePort == 0 {
if (options.SecureServingOptions == nil || options.SecureServingOptions.ServingOptions.BindPort == 0) && options.InsecurePort == 0 {
glog.Fatalf("--secure-port and --insecure-port cannot be turned off at the same time.")
}
if options.SecurePort == options.InsecurePort {
if options.SecureServingOptions != nil && options.SecureServingOptions.ServingOptions.BindPort == options.InsecurePort {
errors = append(errors, fmt.Errorf("--secure-port and --insecure-port cannot use the same port."))
}
return errors