diff --git a/cmd/hyperkube/kube-apiserver.go b/cmd/hyperkube/kube-apiserver.go index 61041e1d99c..423d1f51efa 100644 --- a/cmd/hyperkube/kube-apiserver.go +++ b/cmd/hyperkube/kube-apiserver.go @@ -24,7 +24,7 @@ import ( // NewKubeAPIServer creates a new hyperkube Server object that includes the // description and flags. func NewKubeAPIServer() *Server { - s := options.NewAPIServer() + s := options.NewServerRunOptions() hks := Server{ SimpleUsage: "apiserver", diff --git a/cmd/kube-apiserver/apiserver.go b/cmd/kube-apiserver/apiserver.go index ab0524737c7..4b06d11363c 100644 --- a/cmd/kube-apiserver/apiserver.go +++ b/cmd/kube-apiserver/apiserver.go @@ -38,7 +38,7 @@ import ( func main() { rand.Seed(time.Now().UTC().UnixNano()) - s := options.NewAPIServer() + s := options.NewServerRunOptions() s.AddFlags(pflag.CommandLine) flag.InitFlags() diff --git a/cmd/kube-apiserver/app/options/options.go b/cmd/kube-apiserver/app/options/options.go index 6305b25cdd2..3a08d50ade7 100644 --- a/cmd/kube-apiserver/app/options/options.go +++ b/cmd/kube-apiserver/app/options/options.go @@ -28,8 +28,8 @@ import ( "github.com/spf13/pflag" ) -// APIServer runs a kubernetes api server. -type APIServer struct { +// ServerRunOptions runs a kubernetes api server. +type ServerRunOptions struct { *genericoptions.ServerRunOptions AllowPrivileged bool EventTTL time.Duration @@ -43,9 +43,9 @@ type APIServer struct { WebhookTokenAuthnCacheTTL time.Duration } -// NewAPIServer creates a new APIServer object with default parameters -func NewAPIServer() *APIServer { - s := APIServer{ +// NewServerRunOptions creates a new ServerRunOptions object with default parameters +func NewServerRunOptions() *ServerRunOptions { + s := ServerRunOptions{ ServerRunOptions: genericoptions.NewServerRunOptions().WithEtcdOptions(), EventTTL: 1 * time.Hour, KubeletConfig: kubeletclient.KubeletClientConfig{ @@ -59,7 +59,7 @@ func NewAPIServer() *APIServer { } // AddFlags adds flags for a specific APIServer to the specified FlagSet -func (s *APIServer) AddFlags(fs *pflag.FlagSet) { +func (s *ServerRunOptions) AddFlags(fs *pflag.FlagSet) { // Add the generic flags. s.ServerRunOptions.AddUniversalFlags(fs) //Add etcd specific flags. diff --git a/cmd/kube-apiserver/app/options/options_test.go b/cmd/kube-apiserver/app/options/options_test.go index 4cb47c3edfe..6642256c265 100644 --- a/cmd/kube-apiserver/app/options/options_test.go +++ b/cmd/kube-apiserver/app/options/options_test.go @@ -26,7 +26,7 @@ func TestAddFlagsFlag(t *testing.T) { // TODO: This only tests the enable-swagger-ui flag for now. // Expand the test to include other flags as well. f := pflag.NewFlagSet("addflagstest", pflag.ContinueOnError) - s := NewAPIServer() + s := NewServerRunOptions() s.AddFlags(f) if s.EnableSwaggerUI { t.Errorf("Expected s.EnableSwaggerUI to be false by default") diff --git a/cmd/kube-apiserver/app/server.go b/cmd/kube-apiserver/app/server.go index e0017c835c2..b23765f5252 100644 --- a/cmd/kube-apiserver/app/server.go +++ b/cmd/kube-apiserver/app/server.go @@ -63,7 +63,7 @@ import ( // NewAPIServerCommand creates a *cobra.Command object with default parameters func NewAPIServerCommand() *cobra.Command { - s := options.NewAPIServer() + s := options.NewServerRunOptions() s.AddFlags(pflag.CommandLine) cmd := &cobra.Command{ Use: "kube-apiserver", @@ -79,7 +79,7 @@ cluster's shared state through which all other components interact.`, } // Run runs the specified APIServer. This should never exit. -func Run(s *options.APIServer) error { +func Run(s *options.ServerRunOptions) error { genericvalidation.VerifyEtcdServersList(s.ServerRunOptions) genericapiserver.DefaultAndValidateRunOptions(s.ServerRunOptions) genericConfig := genericapiserver.NewConfig(). // create the new config diff --git a/cmd/kube-apiserver/app/server_test.go b/cmd/kube-apiserver/app/server_test.go index 6335fe7cc2e..ca8d12dc0b9 100644 --- a/cmd/kube-apiserver/app/server_test.go +++ b/cmd/kube-apiserver/app/server_test.go @@ -24,7 +24,7 @@ import ( ) func TestLongRunningRequestRegexp(t *testing.T) { - regexp := regexp.MustCompile(options.NewAPIServer().LongRunningRequestRE) + regexp := regexp.MustCompile(options.NewServerRunOptions().LongRunningRequestRE) dontMatch := []string{ "/api/v1/watch-namespace/", "/api/v1/namespace-proxy/", diff --git a/test/e2e_node/services/apiserver.go b/test/e2e_node/services/apiserver.go index dd7069fa79e..330434cf2e4 100644 --- a/test/e2e_node/services/apiserver.go +++ b/test/e2e_node/services/apiserver.go @@ -40,7 +40,7 @@ func NewAPIServer() *APIServer { // Start starts the apiserver, returns when apiserver is ready. func (a *APIServer) Start() error { - config := options.NewAPIServer() + config := options.NewServerRunOptions() config.StorageConfig.ServerList = []string{getEtcdClientURL()} _, ipnet, err := net.ParseCIDR(clusterIPRange) if err != nil {