Commit d40bfff2 authored by Kubernetes Submit Queue's avatar Kubernetes Submit Queue Committed by GitHub

Merge pull request #50135 from m1093782566/fed-apiserver-validation

Automatic merge from submit-queue add some checks for fedration-apiserver options **What this PR does / why we need it**: I find there is a TODO, see https://github.com/kubernetes/kubernetes/blob/master/federation/cmd/federation-apiserver/app/options/validation.go#L30 This PR add some checks for fedration-apiserver options @sttts **Which issue this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close that issue when PR gets merged)*: fixes # **Special notes for your reviewer**: **Release note**: ```release-note NONE ```
parents 7adb6750 172ab88c
...@@ -16,6 +16,8 @@ limitations under the License. ...@@ -16,6 +16,8 @@ limitations under the License.
package options package options
import "fmt"
func (options *ServerRunOptions) Validate() []error { func (options *ServerRunOptions) Validate() []error {
var errors []error var errors []error
if errs := options.Etcd.Validate(); len(errs) > 0 { if errs := options.Etcd.Validate(); len(errs) > 0 {
...@@ -27,6 +29,27 @@ func (options *ServerRunOptions) Validate() []error { ...@@ -27,6 +29,27 @@ 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 errs := options.Audit.Validate(); len(errs) > 0 {
errors = append(errors, errs...)
}
if errs := options.Features.Validate(); len(errs) > 0 {
errors = append(errors, errs...)
}
if errs := options.Admission.Validate(); len(errs) > 0 {
errors = append(errors, errs...)
}
if errs := options.Authentication.Validate(); len(errs) > 0 {
errors = append(errors, errs...)
}
if errs := options.Authorization.Validate(); len(errs) > 0 {
errors = append(errors, errs...)
}
if errs := options.CloudProvider.Validate(); len(errs) > 0 {
errors = append(errors, errs...)
}
if options.EventTTL <= 0 {
errors = append(errors, fmt.Errorf("--event-ttl must be greater than 0"))
}
// TODO: add more checks // TODO: add more checks
return errors return errors
} }
...@@ -89,3 +89,8 @@ func (a *AdmissionOptions) ApplyTo(serverCfg *server.Config, pluginInitializers ...@@ -89,3 +89,8 @@ func (a *AdmissionOptions) ApplyTo(serverCfg *server.Config, pluginInitializers
serverCfg.AdmissionControl = admissionChain serverCfg.AdmissionControl = admissionChain
return nil return nil
} }
func (a *AdmissionOptions) Validate() []error {
errs := []error{}
return errs
}
...@@ -55,3 +55,8 @@ func (o *FeatureOptions) ApplyTo(c *server.Config) error { ...@@ -55,3 +55,8 @@ func (o *FeatureOptions) ApplyTo(c *server.Config) error {
return nil return nil
} }
func (o *FeatureOptions) Validate() []error {
errs := []error{}
return errs
}
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