mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-11 21:12:07 +00:00
Updating methods to return error rather than using glog.Fatalf
This commit is contained in:
parent
2aa28c6553
commit
c7beb9078c
@ -170,7 +170,10 @@ func startComponents(firstManifestURL, secondManifestURL string) (string, string
|
|||||||
masterConfig.CacheTimeout = 2 * time.Second
|
masterConfig.CacheTimeout = 2 * time.Second
|
||||||
|
|
||||||
// Create a master and install handlers into mux.
|
// Create a master and install handlers into mux.
|
||||||
m := master.New(masterConfig)
|
m, err := master.New(masterConfig)
|
||||||
|
if err != nil {
|
||||||
|
glog.Fatalf("Error in bringing up the master: %v", err)
|
||||||
|
}
|
||||||
handler.delegate = m.Handler
|
handler.delegate = m.Handler
|
||||||
|
|
||||||
// Scheduler
|
// Scheduler
|
||||||
|
@ -389,7 +389,10 @@ func Run(s *options.APIServer) error {
|
|||||||
|
|
||||||
Tunneler: tunneler,
|
Tunneler: tunneler,
|
||||||
}
|
}
|
||||||
m := master.New(config)
|
m, err := master.New(config)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
m.Run(s.ServerRunOptions)
|
m.Run(s.ServerRunOptions)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
@ -17,7 +17,8 @@ limitations under the License.
|
|||||||
package apiserver
|
package apiserver
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/golang/glog"
|
"fmt"
|
||||||
|
|
||||||
"k8s.io/kubernetes/cmd/libs/go2idl/client-gen/testdata/apis/testgroup/v1"
|
"k8s.io/kubernetes/cmd/libs/go2idl/client-gen/testdata/apis/testgroup/v1"
|
||||||
testgroupetcd "k8s.io/kubernetes/examples/apiserver/rest"
|
testgroupetcd "k8s.io/kubernetes/examples/apiserver/rest"
|
||||||
"k8s.io/kubernetes/pkg/api"
|
"k8s.io/kubernetes/pkg/api"
|
||||||
@ -45,24 +46,27 @@ func newStorageDestinations(groupName string, groupMeta *apimachinery.GroupMeta)
|
|||||||
return &storageDestinations, nil
|
return &storageDestinations, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func Run() {
|
func Run() error {
|
||||||
config := genericapiserver.Config{
|
config := genericapiserver.Config{
|
||||||
EnableIndex: true,
|
EnableIndex: true,
|
||||||
APIPrefix: "/api",
|
APIPrefix: "/api",
|
||||||
APIGroupPrefix: "/apis",
|
APIGroupPrefix: "/apis",
|
||||||
Serializer: api.Codecs,
|
Serializer: api.Codecs,
|
||||||
}
|
}
|
||||||
s := genericapiserver.New(&config)
|
s, err := genericapiserver.New(&config)
|
||||||
|
if err != nil {
|
||||||
|
return fmt.Errorf("Error in bringing up the server: %v", err)
|
||||||
|
}
|
||||||
|
|
||||||
groupVersion := v1.SchemeGroupVersion
|
groupVersion := v1.SchemeGroupVersion
|
||||||
groupName := groupVersion.Group
|
groupName := groupVersion.Group
|
||||||
groupMeta, err := registered.Group(groupName)
|
groupMeta, err := registered.Group(groupName)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
glog.Fatalf("%v", err)
|
return fmt.Errorf("%v", err)
|
||||||
}
|
}
|
||||||
storageDestinations, err := newStorageDestinations(groupName, groupMeta)
|
storageDestinations, err := newStorageDestinations(groupName, groupMeta)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
glog.Fatalf("Unable to init etcd: %v", err)
|
return fmt.Errorf("Unable to init etcd: %v", err)
|
||||||
}
|
}
|
||||||
restStorageMap := map[string]rest.Storage{
|
restStorageMap := map[string]rest.Storage{
|
||||||
"testtypes": testgroupetcd.NewREST(storageDestinations.Get(groupName, "testtype"), s.StorageDecorator()),
|
"testtypes": testgroupetcd.NewREST(storageDestinations.Get(groupName, "testtype"), s.StorageDecorator()),
|
||||||
@ -76,7 +80,8 @@ func Run() {
|
|||||||
NegotiatedSerializer: api.Codecs,
|
NegotiatedSerializer: api.Codecs,
|
||||||
}
|
}
|
||||||
if err := s.InstallAPIGroups([]genericapiserver.APIGroupInfo{apiGroupInfo}); err != nil {
|
if err := s.InstallAPIGroups([]genericapiserver.APIGroupInfo{apiGroupInfo}); err != nil {
|
||||||
glog.Fatalf("Error in installing API: %v", err)
|
return fmt.Errorf("Error in installing API: %v", err)
|
||||||
}
|
}
|
||||||
s.Run(genericapiserver.NewServerRunOptions())
|
s.Run(genericapiserver.NewServerRunOptions())
|
||||||
|
return nil
|
||||||
}
|
}
|
||||||
|
@ -35,7 +35,11 @@ var serverIP = "http://localhost:8080"
|
|||||||
var groupVersion = v1.SchemeGroupVersion
|
var groupVersion = v1.SchemeGroupVersion
|
||||||
|
|
||||||
func TestRun(t *testing.T) {
|
func TestRun(t *testing.T) {
|
||||||
go Run()
|
go func() {
|
||||||
|
if err := Run(); err != nil {
|
||||||
|
t.Fatalf("Error in bringing up the server: %v", err)
|
||||||
|
}
|
||||||
|
}()
|
||||||
if err := waitForApiserverUp(); err != nil {
|
if err := waitForApiserverUp(); err != nil {
|
||||||
t.Fatalf("%v", err)
|
t.Fatalf("%v", err)
|
||||||
}
|
}
|
||||||
|
@ -18,8 +18,12 @@ package main
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"k8s.io/kubernetes/examples/apiserver"
|
"k8s.io/kubernetes/examples/apiserver"
|
||||||
|
|
||||||
|
"github.com/golang/glog"
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
apiserver.Run()
|
if err := apiserver.Run(); err != nil {
|
||||||
|
glog.Fatalf("Error in bringing up the server: %v", err)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -378,9 +378,9 @@ func setDefaults(c *Config) {
|
|||||||
// If the caller wants to add additional endpoints not using the GenericAPIServer's
|
// If the caller wants to add additional endpoints not using the GenericAPIServer's
|
||||||
// auth, then the caller should create a handler for those endpoints, which delegates the
|
// auth, then the caller should create a handler for those endpoints, which delegates the
|
||||||
// any unhandled paths to "Handler".
|
// any unhandled paths to "Handler".
|
||||||
func New(c *Config) *GenericAPIServer {
|
func New(c *Config) (*GenericAPIServer, error) {
|
||||||
if c.Serializer == nil {
|
if c.Serializer == nil {
|
||||||
glog.Fatalf("Genericapiserver.New() called with config.Serializer == nil")
|
return nil, fmt.Errorf("Genericapiserver.New() called with config.Serializer == nil")
|
||||||
}
|
}
|
||||||
setDefaults(c)
|
setDefaults(c)
|
||||||
|
|
||||||
@ -435,7 +435,7 @@ func New(c *Config) *GenericAPIServer {
|
|||||||
|
|
||||||
s.init(c)
|
s.init(c)
|
||||||
|
|
||||||
return s
|
return s, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *GenericAPIServer) NewRequestInfoResolver() *apiserver.RequestInfoResolver {
|
func (s *GenericAPIServer) NewRequestInfoResolver() *apiserver.RequestInfoResolver {
|
||||||
|
@ -56,7 +56,10 @@ func TestNew(t *testing.T) {
|
|||||||
config.ProxyTLSClientConfig = &tls.Config{}
|
config.ProxyTLSClientConfig = &tls.Config{}
|
||||||
config.Serializer = api.Codecs
|
config.Serializer = api.Codecs
|
||||||
|
|
||||||
s := New(&config)
|
s, err := New(&config)
|
||||||
|
if err != nil {
|
||||||
|
t.Fatalf("Error in bringing up the server: %v", err)
|
||||||
|
}
|
||||||
|
|
||||||
// Verify many of the variables match their config counterparts
|
// Verify many of the variables match their config counterparts
|
||||||
assert.Equal(s.enableLogsSupport, config.EnableLogsSupport)
|
assert.Equal(s.enableLogsSupport, config.EnableLogsSupport)
|
||||||
@ -97,7 +100,11 @@ func TestInstallAPIGroups(t *testing.T) {
|
|||||||
config.APIGroupPrefix = "/apiGroupPrefix"
|
config.APIGroupPrefix = "/apiGroupPrefix"
|
||||||
config.Serializer = api.Codecs
|
config.Serializer = api.Codecs
|
||||||
|
|
||||||
s := New(&config)
|
s, err := New(&config)
|
||||||
|
if err != nil {
|
||||||
|
t.Fatalf("Error in bringing up the server: %v", err)
|
||||||
|
}
|
||||||
|
|
||||||
apiGroupMeta := registered.GroupOrDie(api.GroupName)
|
apiGroupMeta := registered.GroupOrDie(api.GroupName)
|
||||||
extensionsGroupMeta := registered.GroupOrDie(extensions.GroupName)
|
extensionsGroupMeta := registered.GroupOrDie(extensions.GroupName)
|
||||||
apiGroupsInfo := []APIGroupInfo{
|
apiGroupsInfo := []APIGroupInfo{
|
||||||
|
@ -131,12 +131,15 @@ type thirdPartyEntry struct {
|
|||||||
// Certain config fields will be set to a default value if unset.
|
// Certain config fields will be set to a default value if unset.
|
||||||
// Certain config fields must be specified, including:
|
// Certain config fields must be specified, including:
|
||||||
// KubeletClient
|
// KubeletClient
|
||||||
func New(c *Config) *Master {
|
func New(c *Config) (*Master, error) {
|
||||||
if c.KubeletClient == nil {
|
if c.KubeletClient == nil {
|
||||||
glog.Fatalf("Master.New() called with config.KubeletClient == nil")
|
return nil, fmt.Errorf("Master.New() called with config.KubeletClient == nil")
|
||||||
}
|
}
|
||||||
|
|
||||||
s := genericapiserver.New(c.Config)
|
s, err := genericapiserver.New(c.Config)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
m := &Master{
|
m := &Master{
|
||||||
GenericAPIServer: s,
|
GenericAPIServer: s,
|
||||||
@ -155,7 +158,7 @@ func New(c *Config) *Master {
|
|||||||
m.NewBootstrapController().Start()
|
m.NewBootstrapController().Start()
|
||||||
}
|
}
|
||||||
|
|
||||||
return m
|
return m, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *Master) InstallAPIs(c *Config) {
|
func (m *Master) InstallAPIs(c *Config) {
|
||||||
|
@ -89,7 +89,11 @@ func newMaster(t *testing.T) (*Master, *etcdtesting.EtcdTestServer, Config, *ass
|
|||||||
config.ProxyDialer = func(network, addr string) (net.Conn, error) { return nil, nil }
|
config.ProxyDialer = func(network, addr string) (net.Conn, error) { return nil, nil }
|
||||||
config.ProxyTLSClientConfig = &tls.Config{}
|
config.ProxyTLSClientConfig = &tls.Config{}
|
||||||
|
|
||||||
master := New(&config)
|
master, err := New(&config)
|
||||||
|
if err != nil {
|
||||||
|
t.Fatalf("Error in bringing up the master: %v", err)
|
||||||
|
}
|
||||||
|
|
||||||
return master, etcdserver, config, assert
|
return master, etcdserver, config, assert
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -45,7 +45,10 @@ func mustSetupScheduler() (schedulerConfigFactory *factory.ConfigFactory, destro
|
|||||||
|
|
||||||
var m *master.Master
|
var m *master.Master
|
||||||
masterConfig := framework.NewIntegrationTestMasterConfig()
|
masterConfig := framework.NewIntegrationTestMasterConfig()
|
||||||
m = master.New(masterConfig)
|
m, err := master.New(masterConfig)
|
||||||
|
if err != nil {
|
||||||
|
panic("error in brining up the master: " + err.Error())
|
||||||
|
}
|
||||||
s := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, req *http.Request) {
|
s := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, req *http.Request) {
|
||||||
m.Handler.ServeHTTP(w, req)
|
m.Handler.ServeHTTP(w, req)
|
||||||
}))
|
}))
|
||||||
|
@ -394,7 +394,10 @@ func TestAuthModeAlwaysAllow(t *testing.T) {
|
|||||||
// defer s.Close()
|
// defer s.Close()
|
||||||
|
|
||||||
masterConfig := framework.NewIntegrationTestMasterConfig()
|
masterConfig := framework.NewIntegrationTestMasterConfig()
|
||||||
m = master.New(masterConfig)
|
m, err := master.New(masterConfig)
|
||||||
|
if err != nil {
|
||||||
|
t.Fatalf("error in bringing up the master: %v", err)
|
||||||
|
}
|
||||||
|
|
||||||
transport := http.DefaultTransport
|
transport := http.DefaultTransport
|
||||||
previousResourceVersion := make(map[string]float64)
|
previousResourceVersion := make(map[string]float64)
|
||||||
@ -498,7 +501,10 @@ func TestAuthModeAlwaysDeny(t *testing.T) {
|
|||||||
|
|
||||||
masterConfig := framework.NewIntegrationTestMasterConfig()
|
masterConfig := framework.NewIntegrationTestMasterConfig()
|
||||||
masterConfig.Authorizer = apiserver.NewAlwaysDenyAuthorizer()
|
masterConfig.Authorizer = apiserver.NewAlwaysDenyAuthorizer()
|
||||||
m = master.New(masterConfig)
|
m, err := master.New(masterConfig)
|
||||||
|
if err != nil {
|
||||||
|
t.Fatalf("error in bringing up the master: %v", err)
|
||||||
|
}
|
||||||
|
|
||||||
transport := http.DefaultTransport
|
transport := http.DefaultTransport
|
||||||
|
|
||||||
@ -555,7 +561,10 @@ func TestAliceNotForbiddenOrUnauthorized(t *testing.T) {
|
|||||||
masterConfig.Authenticator = getTestTokenAuth()
|
masterConfig.Authenticator = getTestTokenAuth()
|
||||||
masterConfig.Authorizer = allowAliceAuthorizer{}
|
masterConfig.Authorizer = allowAliceAuthorizer{}
|
||||||
masterConfig.AdmissionControl = admit.NewAlwaysAdmit()
|
masterConfig.AdmissionControl = admit.NewAlwaysAdmit()
|
||||||
m = master.New(masterConfig)
|
m, err := master.New(masterConfig)
|
||||||
|
if err != nil {
|
||||||
|
t.Fatalf("error in bringing up the master: %v", err)
|
||||||
|
}
|
||||||
|
|
||||||
previousResourceVersion := make(map[string]float64)
|
previousResourceVersion := make(map[string]float64)
|
||||||
transport := http.DefaultTransport
|
transport := http.DefaultTransport
|
||||||
@ -630,7 +639,10 @@ func TestBobIsForbidden(t *testing.T) {
|
|||||||
masterConfig := framework.NewIntegrationTestMasterConfig()
|
masterConfig := framework.NewIntegrationTestMasterConfig()
|
||||||
masterConfig.Authenticator = getTestTokenAuth()
|
masterConfig.Authenticator = getTestTokenAuth()
|
||||||
masterConfig.Authorizer = allowAliceAuthorizer{}
|
masterConfig.Authorizer = allowAliceAuthorizer{}
|
||||||
m = master.New(masterConfig)
|
m, err := master.New(masterConfig)
|
||||||
|
if err != nil {
|
||||||
|
t.Fatalf("error in bringing up the master: %v", err)
|
||||||
|
}
|
||||||
|
|
||||||
transport := http.DefaultTransport
|
transport := http.DefaultTransport
|
||||||
|
|
||||||
@ -679,7 +691,10 @@ func TestUnknownUserIsUnauthorized(t *testing.T) {
|
|||||||
masterConfig := framework.NewIntegrationTestMasterConfig()
|
masterConfig := framework.NewIntegrationTestMasterConfig()
|
||||||
masterConfig.Authenticator = getTestTokenAuth()
|
masterConfig.Authenticator = getTestTokenAuth()
|
||||||
masterConfig.Authorizer = allowAliceAuthorizer{}
|
masterConfig.Authorizer = allowAliceAuthorizer{}
|
||||||
m = master.New(masterConfig)
|
m, err := master.New(masterConfig)
|
||||||
|
if err != nil {
|
||||||
|
t.Fatalf("error in bringing up the master: %v", err)
|
||||||
|
}
|
||||||
|
|
||||||
transport := http.DefaultTransport
|
transport := http.DefaultTransport
|
||||||
|
|
||||||
@ -753,7 +768,10 @@ func TestAuthorizationAttributeDetermination(t *testing.T) {
|
|||||||
masterConfig := framework.NewIntegrationTestMasterConfig()
|
masterConfig := framework.NewIntegrationTestMasterConfig()
|
||||||
masterConfig.Authenticator = getTestTokenAuth()
|
masterConfig.Authenticator = getTestTokenAuth()
|
||||||
masterConfig.Authorizer = trackingAuthorizer
|
masterConfig.Authorizer = trackingAuthorizer
|
||||||
m = master.New(masterConfig)
|
m, err := master.New(masterConfig)
|
||||||
|
if err != nil {
|
||||||
|
t.Fatalf("error in bringing up the master: %v", err)
|
||||||
|
}
|
||||||
|
|
||||||
transport := http.DefaultTransport
|
transport := http.DefaultTransport
|
||||||
|
|
||||||
@ -822,7 +840,10 @@ func TestNamespaceAuthorization(t *testing.T) {
|
|||||||
masterConfig := framework.NewIntegrationTestMasterConfig()
|
masterConfig := framework.NewIntegrationTestMasterConfig()
|
||||||
masterConfig.Authenticator = getTestTokenAuth()
|
masterConfig.Authenticator = getTestTokenAuth()
|
||||||
masterConfig.Authorizer = a
|
masterConfig.Authorizer = a
|
||||||
m = master.New(masterConfig)
|
m, err := master.New(masterConfig)
|
||||||
|
if err != nil {
|
||||||
|
t.Fatalf("error in bringing up the master: %v", err)
|
||||||
|
}
|
||||||
|
|
||||||
previousResourceVersion := make(map[string]float64)
|
previousResourceVersion := make(map[string]float64)
|
||||||
transport := http.DefaultTransport
|
transport := http.DefaultTransport
|
||||||
@ -925,7 +946,10 @@ func TestKindAuthorization(t *testing.T) {
|
|||||||
masterConfig := framework.NewIntegrationTestMasterConfig()
|
masterConfig := framework.NewIntegrationTestMasterConfig()
|
||||||
masterConfig.Authenticator = getTestTokenAuth()
|
masterConfig.Authenticator = getTestTokenAuth()
|
||||||
masterConfig.Authorizer = a
|
masterConfig.Authorizer = a
|
||||||
m = master.New(masterConfig)
|
m, err := master.New(masterConfig)
|
||||||
|
if err != nil {
|
||||||
|
t.Fatalf("error in bringing up the master: %v", err)
|
||||||
|
}
|
||||||
|
|
||||||
previousResourceVersion := make(map[string]float64)
|
previousResourceVersion := make(map[string]float64)
|
||||||
transport := http.DefaultTransport
|
transport := http.DefaultTransport
|
||||||
@ -1016,7 +1040,10 @@ func TestReadOnlyAuthorization(t *testing.T) {
|
|||||||
masterConfig.Authenticator = getTestTokenAuth()
|
masterConfig.Authenticator = getTestTokenAuth()
|
||||||
masterConfig.Authorizer = a
|
masterConfig.Authorizer = a
|
||||||
|
|
||||||
m = master.New(masterConfig)
|
m, err := master.New(masterConfig)
|
||||||
|
if err != nil {
|
||||||
|
t.Fatalf("error in bringing up the master: %v", err)
|
||||||
|
}
|
||||||
|
|
||||||
transport := http.DefaultTransport
|
transport := http.DefaultTransport
|
||||||
|
|
||||||
|
@ -195,7 +195,10 @@ func TestSchedulerExtender(t *testing.T) {
|
|||||||
// defer s.Close()
|
// defer s.Close()
|
||||||
|
|
||||||
masterConfig := framework.NewIntegrationTestMasterConfig()
|
masterConfig := framework.NewIntegrationTestMasterConfig()
|
||||||
m = master.New(masterConfig)
|
m, err := master.New(masterConfig)
|
||||||
|
if err != nil {
|
||||||
|
t.Fatalf("error in bringing up the master: %v", err)
|
||||||
|
}
|
||||||
|
|
||||||
restClient := client.NewOrDie(&client.Config{Host: s.URL, ContentConfig: client.ContentConfig{GroupVersion: testapi.Default.GroupVersion()}})
|
restClient := client.NewOrDie(&client.Config{Host: s.URL, ContentConfig: client.ContentConfig{GroupVersion: testapi.Default.GroupVersion()}})
|
||||||
|
|
||||||
|
@ -135,7 +135,11 @@ func startMasterOrDie(masterConfig *master.Config) (*master.Master, *httptest.Se
|
|||||||
masterConfig.EnableProfiling = true
|
masterConfig.EnableProfiling = true
|
||||||
masterConfig.EnableSwaggerSupport = true
|
masterConfig.EnableSwaggerSupport = true
|
||||||
}
|
}
|
||||||
m = master.New(masterConfig)
|
m, err := master.New(masterConfig)
|
||||||
|
if err != nil {
|
||||||
|
glog.Fatalf("error in bringing up the master: %v", err)
|
||||||
|
}
|
||||||
|
|
||||||
return m, s
|
return m, s
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -289,7 +293,11 @@ func StartPods(numPods int, host string, restClient *client.Client) error {
|
|||||||
func RunAMaster(t *testing.T) (*master.Master, *httptest.Server) {
|
func RunAMaster(t *testing.T) (*master.Master, *httptest.Server) {
|
||||||
masterConfig := NewMasterConfig()
|
masterConfig := NewMasterConfig()
|
||||||
masterConfig.EnableProfiling = true
|
masterConfig.EnableProfiling = true
|
||||||
m := master.New(masterConfig)
|
m, err := master.New(masterConfig)
|
||||||
|
if err != nil {
|
||||||
|
// TODO: Return error.
|
||||||
|
glog.Fatalf("error in bringing up the master: %v", err)
|
||||||
|
}
|
||||||
|
|
||||||
s := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, req *http.Request) {
|
s := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, req *http.Request) {
|
||||||
m.Handler.ServeHTTP(w, req)
|
m.Handler.ServeHTTP(w, req)
|
||||||
|
@ -62,7 +62,10 @@ func TestUnschedulableNodes(t *testing.T) {
|
|||||||
// defer s.Close()
|
// defer s.Close()
|
||||||
|
|
||||||
masterConfig := framework.NewIntegrationTestMasterConfig()
|
masterConfig := framework.NewIntegrationTestMasterConfig()
|
||||||
m = master.New(masterConfig)
|
m, err := master.New(masterConfig)
|
||||||
|
if err != nil {
|
||||||
|
t.Fatalf("Error in bringing up the master: %v", err)
|
||||||
|
}
|
||||||
|
|
||||||
restClient := client.NewOrDie(&client.Config{Host: s.URL, ContentConfig: client.ContentConfig{GroupVersion: testapi.Default.GroupVersion()}})
|
restClient := client.NewOrDie(&client.Config{Host: s.URL, ContentConfig: client.ContentConfig{GroupVersion: testapi.Default.GroupVersion()}})
|
||||||
|
|
||||||
@ -286,7 +289,11 @@ func TestMultiScheduler(t *testing.T) {
|
|||||||
// defer s.Close()
|
// defer s.Close()
|
||||||
|
|
||||||
masterConfig := framework.NewIntegrationTestMasterConfig()
|
masterConfig := framework.NewIntegrationTestMasterConfig()
|
||||||
m = master.New(masterConfig)
|
m, err := master.New(masterConfig)
|
||||||
|
if err != nil {
|
||||||
|
t.Fatalf("Error in bringing up the master: %v", err)
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
This integration tests the multi-scheduler feature in the following way:
|
This integration tests the multi-scheduler feature in the following way:
|
||||||
1. create a default scheduler
|
1. create a default scheduler
|
||||||
@ -461,7 +468,10 @@ func TestAllocatable(t *testing.T) {
|
|||||||
defer s.Close()
|
defer s.Close()
|
||||||
|
|
||||||
masterConfig := framework.NewIntegrationTestMasterConfig()
|
masterConfig := framework.NewIntegrationTestMasterConfig()
|
||||||
m = master.New(masterConfig)
|
m, err := master.New(masterConfig)
|
||||||
|
if err != nil {
|
||||||
|
t.Fatalf("Error in bringing up the master: %v", err)
|
||||||
|
}
|
||||||
|
|
||||||
// 1. create and start default-scheduler
|
// 1. create and start default-scheduler
|
||||||
restClient := client.NewOrDie(&client.Config{Host: s.URL, ContentConfig: client.ContentConfig{GroupVersion: testapi.Default.GroupVersion()}})
|
restClient := client.NewOrDie(&client.Config{Host: s.URL, ContentConfig: client.ContentConfig{GroupVersion: testapi.Default.GroupVersion()}})
|
||||||
|
@ -53,7 +53,10 @@ func TestSecrets(t *testing.T) {
|
|||||||
// defer s.Close()
|
// defer s.Close()
|
||||||
|
|
||||||
masterConfig := framework.NewIntegrationTestMasterConfig()
|
masterConfig := framework.NewIntegrationTestMasterConfig()
|
||||||
m = master.New(masterConfig)
|
m, err := master.New(masterConfig)
|
||||||
|
if err != nil {
|
||||||
|
t.Fatalf("Error in bringing up the master: %v", err)
|
||||||
|
}
|
||||||
|
|
||||||
framework.DeleteAllEtcdKeys()
|
framework.DeleteAllEtcdKeys()
|
||||||
client := client.NewOrDie(&client.Config{Host: s.URL, ContentConfig: client.ContentConfig{GroupVersion: testapi.Default.GroupVersion()}})
|
client := client.NewOrDie(&client.Config{Host: s.URL, ContentConfig: client.ContentConfig{GroupVersion: testapi.Default.GroupVersion()}})
|
||||||
|
@ -408,7 +408,10 @@ func startServiceAccountTestServer(t *testing.T) (*client.Client, client.Config,
|
|||||||
masterConfig.AdmissionControl = serviceAccountAdmission
|
masterConfig.AdmissionControl = serviceAccountAdmission
|
||||||
|
|
||||||
// Create a master and install handlers into mux.
|
// Create a master and install handlers into mux.
|
||||||
m = master.New(masterConfig)
|
m, err := master.New(masterConfig)
|
||||||
|
if err != nil {
|
||||||
|
t.Fatalf("Error in bringing up the master: %v", err)
|
||||||
|
}
|
||||||
|
|
||||||
// Start the service account and service account token controllers
|
// Start the service account and service account token controllers
|
||||||
tokenController := serviceaccountcontroller.NewTokensController(rootClient, serviceaccountcontroller.TokensControllerOptions{TokenGenerator: serviceaccount.JWTTokenGenerator(serviceAccountKey)})
|
tokenController := serviceaccountcontroller.NewTokensController(rootClient, serviceaccountcontroller.TokensControllerOptions{TokenGenerator: serviceaccount.JWTTokenGenerator(serviceAccountKey)})
|
||||||
|
Loading…
Reference in New Issue
Block a user