Exemplo n.º 1
0
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)
}
// 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
}
Exemplo n.º 3
0
func main() {
	rand.Seed(time.Now().UTC().UnixNano())

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

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

	verflag.PrintAndExitIfRequested()

	if err := app.Run(s); err != nil {
		fmt.Fprintf(os.Stderr, "%v\n", err)
		os.Exit(1)
	}
}
Exemplo n.º 4
0
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)
}