mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-23 19:56:01 +00:00
Merge pull request #50553 from m1093782566/fed-kube-apiserver
Automatic merge from submit-queue (batch tested with PRs 49129, 50436, 50417, 50553, 47587) add validation for fed-apiserver and apiserver run options **What this PR does / why we need it**: Add validation for fed-apiserver and apiserver run options **Which issue this PR fixes** fixes #50552 **Special notes for your reviewer**: This is a follow-up of #50135 **Release note**: ```release-note NONE ```
This commit is contained in:
commit
f9c861aa10
@ -20,6 +20,9 @@ import "fmt"
|
||||
|
||||
func (options *ServerRunOptions) Validate() []error {
|
||||
var errors []error
|
||||
if errs := options.GenericServerRunOptions.Validate(); len(errs) > 0 {
|
||||
errors = append(errors, errs...)
|
||||
}
|
||||
if errs := options.Etcd.Validate(); len(errs) > 0 {
|
||||
errors = append(errors, errs...)
|
||||
}
|
||||
|
@ -83,6 +83,22 @@ func (s *ServerRunOptions) DefaultAdvertiseAddress(secure *SecureServingOptions)
|
||||
return nil
|
||||
}
|
||||
|
||||
// Validate checks validation of ServerRunOptions
|
||||
func (s *ServerRunOptions) Validate() []error {
|
||||
errors := []error{}
|
||||
if s.TargetRAMMB < 0 {
|
||||
errors = append(errors, fmt.Errorf("--target-ram-mb can not be negative value"))
|
||||
}
|
||||
if s.MaxRequestsInFlight < 0 {
|
||||
errors = append(errors, fmt.Errorf("--max-requests-inflight can not be negative value"))
|
||||
}
|
||||
if s.MaxMutatingRequestsInFlight < 0 {
|
||||
errors = append(errors, fmt.Errorf("--min-request-timeout can not be negative value"))
|
||||
}
|
||||
|
||||
return errors
|
||||
}
|
||||
|
||||
// AddFlags adds flags for a specific APIServer to the specified FlagSet
|
||||
func (s *ServerRunOptions) AddUniversalFlags(fs *pflag.FlagSet) {
|
||||
// Note: the weird ""+ in below lines seems to be the only way to get gofmt to
|
||||
|
Loading…
Reference in New Issue
Block a user