Commit 73c900b5 authored by Kubernetes Submit Queue's avatar Kubernetes Submit Queue Committed by GitHub

Merge pull request #38272 from xingzhou/kube-38143

Automatic merge from submit-queue Added validation for API server's 'apiserver-count' flag. Added validation for API server's 'apiserver-count' flag. The value of this flag should be a positive number, otherwise, will cause error while reconciling endpoints in MasterCountEndpointsReconciler. Fixed #38143
parents f74b4bbb 2ae4ab4b
...@@ -121,7 +121,7 @@ func (s *ServerRunOptions) AddFlags(fs *pflag.FlagSet) { ...@@ -121,7 +121,7 @@ func (s *ServerRunOptions) AddFlags(fs *pflag.FlagSet) {
"Currently only applies to long-running requests.") "Currently only applies to long-running requests.")
fs.IntVar(&s.MasterCount, "apiserver-count", s.MasterCount, fs.IntVar(&s.MasterCount, "apiserver-count", s.MasterCount,
"The number of apiservers running in the cluster.") "The number of apiservers running in the cluster, must be a positive number.")
// See #14282 for details on how to test/try this option out. // See #14282 for details on how to test/try this option out.
// TODO: remove this comment once this option is tested in CI. // TODO: remove this comment once this option is tested in CI.
......
...@@ -63,5 +63,8 @@ func (options *ServerRunOptions) Validate() []error { ...@@ -63,5 +63,8 @@ func (options *ServerRunOptions) Validate() []error {
if errs := options.InsecureServing.Validate("insecure-port"); len(errs) > 0 { if errs := options.InsecureServing.Validate("insecure-port"); len(errs) > 0 {
errors = append(errors, errs...) errors = append(errors, errs...)
} }
if options.MasterCount <= 0 {
errors = append(errors, fmt.Errorf("--apiserver-count should be a positive number, but value '%d' provided", options.MasterCount))
}
return errors return errors
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment