當前位置: 首頁>>代碼示例>>Golang>>正文


Golang options.NewServerRunOptions函數代碼示例

本文整理匯總了Golang中k8s/io/kubernetes/federation/cmd/federation-apiserver/app/options.NewServerRunOptions函數的典型用法代碼示例。如果您正苦於以下問題:Golang NewServerRunOptions函數的具體用法?Golang NewServerRunOptions怎麽用?Golang NewServerRunOptions使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了NewServerRunOptions函數的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。

示例1: TestRun

func TestRun(t *testing.T) {
	certDir, err := ioutil.TempDir("", "")
	if err != nil {
		t.Fatalf("Failed to create temporary certificate directory: %v", err)
	}
	defer os.RemoveAll(certDir)

	s := options.NewServerRunOptions()
	s.SecureServing.ServingOptions.BindPort = securePort
	s.InsecureServing.BindPort = insecurePort
	s.Etcd.StorageConfig.ServerList = []string{"http://localhost:2379"}
	s.SecureServing.ServerCert.CertDirectory = certDir

	go func() {
		if err := app.Run(s); err != nil {
			t.Fatalf("Error in bringing up the server: %v", err)
		}
	}()
	if err := waitForApiserverUp(); err != nil {
		t.Fatalf("%v", err)
	}
	testSwaggerSpec(t)
	testSupport(t)
	testAPIGroupList(t)
	testAPIGroup(t)
	testAPIResourceList(t)
}
開發者ID:jonboulle,項目名稱:kubernetes,代碼行數:27,代碼來源:server_test.go

示例2: NewFederationAPIServer

// NewFederationAPIServer creates a new hyperkube Server object that includes the
// description and flags.
func NewFederationAPIServer() *Server {
	s := options.NewServerRunOptions()

	hks := Server{
		SimpleUsage: "federation-apiserver",
		Long:        "The API entrypoint for the federation control plane",
		Run: func(_ *Server, args []string) error {
			return app.Run(s)
		},
	}
	s.AddFlags(hks.Flags())
	return &hks
}
開發者ID:ConnorDoyle,項目名稱:kubernetes,代碼行數:15,代碼來源:federation-apiserver.go

示例3: NewAPIServerCommand

// NewAPIServerCommand creates a *cobra.Command object with default parameters
func NewAPIServerCommand() *cobra.Command {
	s := options.NewServerRunOptions()
	s.AddFlags(pflag.CommandLine)
	cmd := &cobra.Command{
		Use: "federation-apiserver",
		Long: `The Kubernetes federation API server validates and configures data
for the api objects which include pods, services, replicationcontrollers, and
others. The API Server services REST operations and provides the frontend to the
cluster's shared state through which all other components interact.`,
		Run: func(cmd *cobra.Command, args []string) {
		},
	}
	return cmd
}
開發者ID:ncdc,項目名稱:kubernetes,代碼行數:15,代碼來源:server.go

示例4: main

func main() {
	rand.Seed(time.Now().UTC().UnixNano())

	s := options.NewServerRunOptions()
	s.AddFlags(pflag.CommandLine)

	flag.InitFlags()
	logs.InitLogs()
	defer logs.FlushLogs()

	verflag.PrintAndExitIfRequested()

	if err := app.Run(s); err != nil {
		fmt.Fprintf(os.Stderr, "%v\n", err)
		os.Exit(1)
	}
}
開發者ID:humblec,項目名稱:kubernetes,代碼行數:17,代碼來源:apiserver.go

示例5: TestRun

func TestRun(t *testing.T) {
	s := options.NewServerRunOptions()
	s.InsecurePort = insecurePort
	_, ipNet, _ := net.ParseCIDR("10.10.10.0/24")
	s.ServiceClusterIPRange = *ipNet
	s.StorageConfig.ServerList = []string{"http://localhost:2379"}
	go func() {
		if err := app.Run(s); err != nil {
			t.Fatalf("Error in bringing up the server: %v", err)
		}
	}()
	if err := waitForApiserverUp(); err != nil {
		t.Fatalf("%v", err)
	}
	testSwaggerSpec(t)
	testSupport(t)
	testAPIGroupList(t)
	testAPIGroup(t)
	testAPIResourceList(t)
}
開發者ID:astropuffin,項目名稱:kubernetes,代碼行數:20,代碼來源:server_test.go

示例6: TestLongRunningRequestRegexp

func TestLongRunningRequestRegexp(t *testing.T) {
	regexp := regexp.MustCompile(options.NewServerRunOptions().LongRunningRequestRE)
	dontMatch := []string{
		"/api/v1/watch-namespace/",
		"/api/v1/namespace-proxy/",
		"/api/v1/namespace-watch",
		"/api/v1/namespace-proxy",
		"/api/v1/namespace-portforward/pods",
		"/api/v1/portforward/pods",
		". anything",
		"/ that",
	}
	doMatch := []string{
		"/api/v1/pods/watch",
		"/api/v1/watch/stuff",
		"/api/v1/default/service/proxy",
		"/api/v1/pods/proxy/path/to/thing",
		"/api/v1/namespaces/myns/pods/mypod/log",
		"/api/v1/namespaces/myns/pods/mypod/logs",
		"/api/v1/namespaces/myns/pods/mypod/portforward",
		"/api/v1/namespaces/myns/pods/mypod/exec",
		"/api/v1/namespaces/myns/pods/mypod/attach",
		"/api/v1/namespaces/myns/pods/mypod/log/",
		"/api/v1/namespaces/myns/pods/mypod/logs/",
		"/api/v1/namespaces/myns/pods/mypod/portforward/",
		"/api/v1/namespaces/myns/pods/mypod/exec/",
		"/api/v1/namespaces/myns/pods/mypod/attach/",
		"/api/v1/watch/namespaces/myns/pods",
	}
	for _, path := range dontMatch {
		if regexp.MatchString(path) {
			t.Errorf("path should not have match regexp but did: %s", path)
		}
	}
	for _, path := range doMatch {
		if !regexp.MatchString(path) {
			t.Errorf("path should have match regexp did not: %s", path)
		}
	}
}
開發者ID:astropuffin,項目名稱:kubernetes,代碼行數:40,代碼來源:server_test.go


注:本文中的k8s/io/kubernetes/federation/cmd/federation-apiserver/app/options.NewServerRunOptions函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。