This commit is contained in:
Daniel Smith
2020-09-02 10:47:23 -07:00
parent 1f0305fe1b
commit 15e0e3e90e
21 changed files with 68 additions and 68 deletions

View File

@@ -56,13 +56,13 @@ import (
"k8s.io/kubernetes/pkg/generated/openapi"
"k8s.io/kubernetes/pkg/kubeapiserver"
kubeletclient "k8s.io/kubernetes/pkg/kubelet/client"
"k8s.io/kubernetes/pkg/master"
"k8s.io/kubernetes/pkg/controlplane"
)
// Config is a struct of configuration directives for NewMasterComponents.
type Config struct {
// If nil, a default is used, partially filled configs will not get populated.
MasterConfig *master.Config
MasterConfig *controlplane.Config
StartReplicationManager bool
// Client throttling qps
QPS float32
@@ -89,17 +89,17 @@ func alwaysEmpty(req *http.Request) (*authauthenticator.Response, bool, error) {
// MasterReceiver can be used to provide the master to a custom incoming server function
type MasterReceiver interface {
SetMaster(m *master.Master)
SetMaster(m *controlplane.Master)
}
// MasterHolder implements
type MasterHolder struct {
Initialized chan struct{}
M *master.Master
M *controlplane.Master
}
// SetMaster assigns the current master.
func (h *MasterHolder) SetMaster(m *master.Master) {
func (h *MasterHolder) SetMaster(m *controlplane.Master) {
h.M = m
close(h.Initialized)
}
@@ -124,8 +124,8 @@ func DefaultOpenAPIConfig() *openapicommon.Config {
}
// startMasterOrDie starts a kubernetes master and an httpserver to handle api requests
func startMasterOrDie(masterConfig *master.Config, incomingServer *httptest.Server, masterReceiver MasterReceiver) (*master.Master, *httptest.Server, CloseFunc) {
var m *master.Master
func startMasterOrDie(masterConfig *controlplane.Config, incomingServer *httptest.Server, masterReceiver MasterReceiver) (*controlplane.Master, *httptest.Server, CloseFunc) {
var m *controlplane.Master
var s *httptest.Server
// Ensure we log at least level 4
@@ -249,16 +249,16 @@ func startMasterOrDie(masterConfig *master.Config, incomingServer *httptest.Serv
}
// NewIntegrationTestMasterConfig returns the master config appropriate for most integration tests.
func NewIntegrationTestMasterConfig() *master.Config {
func NewIntegrationTestMasterConfig() *controlplane.Config {
return NewIntegrationTestMasterConfigWithOptions(&MasterConfigOptions{})
}
// NewIntegrationTestMasterConfigWithOptions returns the master config appropriate for most integration tests
// configured with the provided options.
func NewIntegrationTestMasterConfigWithOptions(opts *MasterConfigOptions) *master.Config {
func NewIntegrationTestMasterConfigWithOptions(opts *MasterConfigOptions) *controlplane.Config {
masterConfig := NewMasterConfigWithOptions(opts)
masterConfig.GenericConfig.PublicAddress = net.ParseIP("192.168.10.4")
masterConfig.ExtraConfig.APIResourceConfigSource = master.DefaultAPIResourceConfigSource()
masterConfig.ExtraConfig.APIResourceConfigSource = controlplane.DefaultAPIResourceConfigSource()
// TODO: get rid of these tests or port them to secure serving
masterConfig.GenericConfig.SecureServing = &genericapiserver.SecureServingInfo{Listener: fakeLocalhost443Listener{}}
@@ -282,12 +282,12 @@ func DefaultEtcdOptions() *options.EtcdOptions {
}
// NewMasterConfig returns a basic master config.
func NewMasterConfig() *master.Config {
func NewMasterConfig() *controlplane.Config {
return NewMasterConfigWithOptions(&MasterConfigOptions{})
}
// NewMasterConfigWithOptions returns a basic master config configured with the provided options.
func NewMasterConfigWithOptions(opts *MasterConfigOptions) *master.Config {
func NewMasterConfigWithOptions(opts *MasterConfigOptions) *controlplane.Config {
etcdOptions := DefaultEtcdOptions()
if opts.EtcdOptions != nil {
etcdOptions = opts.EtcdOptions
@@ -317,10 +317,10 @@ func NewMasterConfigWithOptions(opts *MasterConfigOptions) *master.Config {
panic(err)
}
return &master.Config{
return &controlplane.Config{
GenericConfig: genericConfig,
ExtraConfig: master.ExtraConfig{
APIResourceConfigSource: master.DefaultAPIResourceConfigSource(),
ExtraConfig: controlplane.ExtraConfig{
APIResourceConfigSource: controlplane.DefaultAPIResourceConfigSource(),
StorageFactory: storageFactory,
KubeletClientConfig: kubeletclient.KubeletClientConfig{Port: 10250},
APIServerServicePort: 443,
@@ -333,7 +333,7 @@ func NewMasterConfigWithOptions(opts *MasterConfigOptions) *master.Config {
type CloseFunc func()
// RunAMaster starts a master with the provided config.
func RunAMaster(masterConfig *master.Config) (*master.Master, *httptest.Server, CloseFunc) {
func RunAMaster(masterConfig *controlplane.Config) (*controlplane.Master, *httptest.Server, CloseFunc) {
if masterConfig == nil {
masterConfig = NewMasterConfig()
masterConfig.GenericConfig.EnableProfiling = true
@@ -342,7 +342,7 @@ func RunAMaster(masterConfig *master.Config) (*master.Master, *httptest.Server,
}
// RunAMasterUsingServer starts up a master using the provided config on the specified server.
func RunAMasterUsingServer(masterConfig *master.Config, s *httptest.Server, masterReceiver MasterReceiver) (*master.Master, *httptest.Server, CloseFunc) {
func RunAMasterUsingServer(masterConfig *controlplane.Config, s *httptest.Server, masterReceiver MasterReceiver) (*controlplane.Master, *httptest.Server, CloseFunc) {
return startMasterOrDie(masterConfig, s, masterReceiver)
}