Merge pull request #23953 from nikhiljindal/u8sServer

Automatic merge from submit-queue

moving genericapiserver command line flags to genericapiserver

cc @kubernetes/sig-api-machinery
This commit is contained in:
k8s-merge-robot
2016-04-13 23:15:24 -07:00
5 changed files with 55 additions and 33 deletions

View File

@@ -55,7 +55,14 @@ func newStorageDestinations(groupName string, groupMeta *apimachinery.GroupMeta)
return &storageDestinations, nil
}
func Run() error {
func NewServerRunOptions() *genericapiserver.ServerRunOptions {
serverOptions := genericapiserver.NewServerRunOptions()
serverOptions.InsecurePort = InsecurePort
serverOptions.SecurePort = SecurePort
return serverOptions
}
func Run(serverOptions *genericapiserver.ServerRunOptions) error {
config := genericapiserver.Config{
EnableIndex: true,
EnableSwaggerSupport: true,
@@ -93,9 +100,6 @@ func Run() error {
if err := s.InstallAPIGroups([]genericapiserver.APIGroupInfo{apiGroupInfo}); err != nil {
return fmt.Errorf("Error in installing API: %v", err)
}
serverOptions := genericapiserver.NewServerRunOptions()
serverOptions.InsecurePort = InsecurePort
serverOptions.SecurePort = SecurePort
s.Run(serverOptions)
return nil
}

View File

@@ -41,7 +41,7 @@ var groupVersionForDiscovery = unversioned.GroupVersionForDiscovery{
func TestRun(t *testing.T) {
go func() {
if err := Run(); err != nil {
if err := Run(NewServerRunOptions()); err != nil {
t.Fatalf("Error in bringing up the server: %v", err)
}
}()

View File

@@ -18,12 +18,20 @@ package main
import (
"k8s.io/kubernetes/examples/apiserver"
"k8s.io/kubernetes/pkg/util/flag"
"github.com/golang/glog"
"github.com/spf13/pflag"
)
func main() {
if err := apiserver.Run(); err != nil {
serverRunOptions := apiserver.NewServerRunOptions()
// Parse command line flags.
serverRunOptions.AddFlags(pflag.CommandLine)
flag.InitFlags()
if err := apiserver.Run(serverRunOptions); err != nil {
glog.Fatalf("Error in bringing up the server: %v", err)
}
}