It's an 'Instance' of apiserver

This commit is contained in:
Daniel Smith 2020-09-11 14:17:08 -07:00 committed by Aaron Crickenberger
parent 2d9a0b64d1
commit 13b6a929bc
4 changed files with 16 additions and 16 deletions

View File

@ -225,7 +225,7 @@ func CreateServerChain(completedOptions completedServerRunOptions, stopCh <-chan
}
// CreateKubeAPIServer creates and wires a workable kube-apiserver
func CreateKubeAPIServer(kubeAPIServerConfig *controlplane.Config, delegateAPIServer genericapiserver.DelegationTarget) (*controlplane.Master, error) {
func CreateKubeAPIServer(kubeAPIServerConfig *controlplane.Config, delegateAPIServer genericapiserver.DelegationTarget) (*controlplane.Instance, error) {
kubeAPIServer, err := kubeAPIServerConfig.Complete().New(delegateAPIServer)
if err != nil {
return nil, err

View File

@ -223,8 +223,8 @@ type EndpointReconcilerConfig struct {
Interval time.Duration
}
// Master contains state for a Kubernetes cluster master/api server.
type Master struct {
// Instance contains state for a Kubernetes cluster api server instance.
type Instance struct {
GenericAPIServer *genericapiserver.GenericAPIServer
ClusterAuthenticationInfo clusterauthenticationtrust.ClusterAuthenticationInfo
@ -334,7 +334,7 @@ func (c *Config) Complete() CompletedConfig {
// Certain config fields will be set to a default value if unset.
// Certain config fields must be specified, including:
// KubeletClientConfig
func (c completedConfig) New(delegationTarget genericapiserver.DelegationTarget) (*Master, error) {
func (c completedConfig) New(delegationTarget genericapiserver.DelegationTarget) (*Instance, error) {
if reflect.DeepEqual(c.ExtraConfig.KubeletClientConfig, kubeletclient.KubeletClientConfig{}) {
return nil, fmt.Errorf("Master.New() called with empty config.KubeletClientConfig")
}
@ -381,7 +381,7 @@ func (c completedConfig) New(delegationTarget genericapiserver.DelegationTarget)
}
}
m := &Master{
m := &Instance{
GenericAPIServer: s,
ClusterAuthenticationInfo: c.ExtraConfig.ClusterAuthenticationInfo,
}
@ -486,7 +486,7 @@ func (c completedConfig) New(delegationTarget genericapiserver.DelegationTarget)
}
// InstallLegacyAPI will install the legacy APIs for the restStorageProviders if they are enabled.
func (m *Master) InstallLegacyAPI(c *completedConfig, restOptionsGetter generic.RESTOptionsGetter, legacyRESTStorageProvider corerest.LegacyRESTStorageProvider) error {
func (m *Instance) InstallLegacyAPI(c *completedConfig, restOptionsGetter generic.RESTOptionsGetter, legacyRESTStorageProvider corerest.LegacyRESTStorageProvider) error {
legacyRESTStorage, apiGroupInfo, err := legacyRESTStorageProvider.NewLegacyRESTStorage(restOptionsGetter)
if err != nil {
return fmt.Errorf("error building core storage: %v", err)
@ -504,7 +504,7 @@ func (m *Master) InstallLegacyAPI(c *completedConfig, restOptionsGetter generic.
return nil
}
func (m *Master) installTunneler(nodeTunneler tunneler.Tunneler, nodeClient corev1client.NodeInterface) {
func (m *Instance) installTunneler(nodeTunneler tunneler.Tunneler, nodeClient corev1client.NodeInterface) {
nodeTunneler.Run(nodeAddressProvider{nodeClient}.externalAddresses)
err := m.GenericAPIServer.AddHealthChecks(healthz.NamedCheck("SSH Tunnel Check", tunneler.TunnelSyncHealthChecker(nodeTunneler)))
if err != nil {
@ -519,7 +519,7 @@ type RESTStorageProvider interface {
}
// InstallAPIs will install the APIs for the restStorageProviders if they are enabled.
func (m *Master) InstallAPIs(apiResourceConfigSource serverstorage.APIResourceConfigSource, restOptionsGetter generic.RESTOptionsGetter, restStorageProviders ...RESTStorageProvider) error {
func (m *Instance) InstallAPIs(apiResourceConfigSource serverstorage.APIResourceConfigSource, restOptionsGetter generic.RESTOptionsGetter, restStorageProviders ...RESTStorageProvider) error {
apiGroupsInfo := []*genericapiserver.APIGroupInfo{}
for _, restStorageBuilder := range restStorageProviders {

View File

@ -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 *controlplane.Master)
SetMaster(m *controlplane.Instance)
}
// MasterHolder implements
type MasterHolder struct {
Initialized chan struct{}
M *controlplane.Master
M *controlplane.Instance
}
// SetMaster assigns the current master.
func (h *MasterHolder) SetMaster(m *controlplane.Master) {
func (h *MasterHolder) SetMaster(m *controlplane.Instance) {
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 *controlplane.Config, incomingServer *httptest.Server, masterReceiver MasterReceiver) (*controlplane.Master, *httptest.Server, CloseFunc) {
var m *controlplane.Master
func startMasterOrDie(masterConfig *controlplane.Config, incomingServer *httptest.Server, masterReceiver MasterReceiver) (*controlplane.Instance, *httptest.Server, CloseFunc) {
var m *controlplane.Instance
var s *httptest.Server
// Ensure we log at least level 4
@ -333,7 +333,7 @@ func NewMasterConfigWithOptions(opts *MasterConfigOptions) *controlplane.Config
type CloseFunc func()
// RunAMaster starts a master with the provided config.
func RunAMaster(masterConfig *controlplane.Config) (*controlplane.Master, *httptest.Server, CloseFunc) {
func RunAMaster(masterConfig *controlplane.Config) (*controlplane.Instance, *httptest.Server, CloseFunc) {
if masterConfig == nil {
masterConfig = NewMasterConfig()
masterConfig.GenericConfig.EnableProfiling = true
@ -342,7 +342,7 @@ func RunAMaster(masterConfig *controlplane.Config) (*controlplane.Master, *httpt
}
// RunAMasterUsingServer starts up a master using the provided config on the specified server.
func RunAMasterUsingServer(masterConfig *controlplane.Config, s *httptest.Server, masterReceiver MasterReceiver) (*controlplane.Master, *httptest.Server, CloseFunc) {
func RunAMasterUsingServer(masterConfig *controlplane.Config, s *httptest.Server, masterReceiver MasterReceiver) (*controlplane.Instance, *httptest.Server, CloseFunc) {
return startMasterOrDie(masterConfig, s, masterReceiver)
}

View File

@ -34,7 +34,7 @@ func TestMasterExportsSymbols(t *testing.T) {
EnableLogsSupport: false,
},
}
_ = &controlplane.Master{
_ = &controlplane.Instance{
GenericAPIServer: &genericapiserver.GenericAPIServer{},
}
}