part of master to controlplane in test/integration

SetMaster -> SetAPIServer
This commit is contained in:
Mengjiao Liu 2021-05-25 17:34:26 +08:00
parent 9d6e5049bb
commit ab45d5e496

View File

@ -89,7 +89,7 @@ func alwaysEmpty(req *http.Request) (*authauthenticator.Response, bool, error) {
// APIServerReceiver can be used to provide the API server to a custom incoming server function // APIServerReceiver can be used to provide the API server to a custom incoming server function
type APIServerReceiver interface { type APIServerReceiver interface {
SetMaster(m *controlplane.Instance) SetAPIServer(m *controlplane.Instance)
} }
// APIServerHolder implements // APIServerHolder implements
@ -98,8 +98,8 @@ type APIServerHolder struct {
M *controlplane.Instance M *controlplane.Instance
} }
// SetMaster assigns the current master. // SetAPIServer assigns the current API server.
func (h *APIServerHolder) SetMaster(m *controlplane.Instance) { func (h *APIServerHolder) SetAPIServer(m *controlplane.Instance) {
h.M = m h.M = m
close(h.Initialized) close(h.Initialized)
} }
@ -123,8 +123,8 @@ func DefaultOpenAPIConfig() *openapicommon.Config {
return openAPIConfig return openAPIConfig
} }
// startApiserverOrDie starts a kubernetes master and an httpserver to handle api requests // startAPIServerOrDie starts a kubernetes master and an httpserver to handle api requests
func startApiserverOrDie(controlPlaneConfig *controlplane.Config, incomingServer *httptest.Server, apiServerReceiver APIServerReceiver) (*controlplane.Instance, *httptest.Server, CloseFunc) { func startAPIServerOrDie(controlPlaneConfig *controlplane.Config, incomingServer *httptest.Server, apiServerReceiver APIServerReceiver) (*controlplane.Instance, *httptest.Server, CloseFunc) {
var m *controlplane.Instance var m *controlplane.Instance
var s *httptest.Server var s *httptest.Server
@ -215,7 +215,7 @@ func startApiserverOrDie(controlPlaneConfig *controlplane.Config, incomingServer
klog.Fatalf("error in bringing up the master: %v", err) klog.Fatalf("error in bringing up the master: %v", err)
} }
if apiServerReceiver != nil { if apiServerReceiver != nil {
apiServerReceiver.SetMaster(m) apiServerReceiver.SetAPIServer(m)
} }
// TODO have this start method actually use the normal start sequence for the API server // TODO have this start method actually use the normal start sequence for the API server
@ -347,12 +347,12 @@ func RunAnAPIServer(masterConfig *controlplane.Config) (*controlplane.Instance,
masterConfig = NewControlPlaneConfig() masterConfig = NewControlPlaneConfig()
masterConfig.GenericConfig.EnableProfiling = true masterConfig.GenericConfig.EnableProfiling = true
} }
return startApiserverOrDie(masterConfig, nil, nil) return startAPIServerOrDie(masterConfig, nil, nil)
} }
// RunAnAPIServerUsingServer starts up an instance using the provided config on the specified server. // RunAnAPIServerUsingServer starts up an instance using the provided config on the specified server.
func RunAnAPIServerUsingServer(controlPlaneConfig *controlplane.Config, s *httptest.Server, apiServerReceiver APIServerReceiver) (*controlplane.Instance, *httptest.Server, CloseFunc) { func RunAnAPIServerUsingServer(controlPlaneConfig *controlplane.Config, s *httptest.Server, apiServerReceiver APIServerReceiver) (*controlplane.Instance, *httptest.Server, CloseFunc) {
return startApiserverOrDie(controlPlaneConfig, s, apiServerReceiver) return startAPIServerOrDie(controlPlaneConfig, s, apiServerReceiver)
} }
// SharedEtcd creates a storage config for a shared etcd instance, with a unique prefix. // SharedEtcd creates a storage config for a shared etcd instance, with a unique prefix.