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 // 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) kubeAPIServer, err := kubeAPIServerConfig.Complete().New(delegateAPIServer)
if err != nil { if err != nil {
return nil, err return nil, err

View File

@ -223,8 +223,8 @@ type EndpointReconcilerConfig struct {
Interval time.Duration Interval time.Duration
} }
// Master contains state for a Kubernetes cluster master/api server. // Instance contains state for a Kubernetes cluster api server instance.
type Master struct { type Instance struct {
GenericAPIServer *genericapiserver.GenericAPIServer GenericAPIServer *genericapiserver.GenericAPIServer
ClusterAuthenticationInfo clusterauthenticationtrust.ClusterAuthenticationInfo 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 will be set to a default value if unset.
// Certain config fields must be specified, including: // Certain config fields must be specified, including:
// KubeletClientConfig // 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{}) { if reflect.DeepEqual(c.ExtraConfig.KubeletClientConfig, kubeletclient.KubeletClientConfig{}) {
return nil, fmt.Errorf("Master.New() called with empty config.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, GenericAPIServer: s,
ClusterAuthenticationInfo: c.ExtraConfig.ClusterAuthenticationInfo, 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. // 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) legacyRESTStorage, apiGroupInfo, err := legacyRESTStorageProvider.NewLegacyRESTStorage(restOptionsGetter)
if err != nil { if err != nil {
return fmt.Errorf("error building core storage: %v", err) return fmt.Errorf("error building core storage: %v", err)
@ -504,7 +504,7 @@ func (m *Master) InstallLegacyAPI(c *completedConfig, restOptionsGetter generic.
return nil 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) nodeTunneler.Run(nodeAddressProvider{nodeClient}.externalAddresses)
err := m.GenericAPIServer.AddHealthChecks(healthz.NamedCheck("SSH Tunnel Check", tunneler.TunnelSyncHealthChecker(nodeTunneler))) err := m.GenericAPIServer.AddHealthChecks(healthz.NamedCheck("SSH Tunnel Check", tunneler.TunnelSyncHealthChecker(nodeTunneler)))
if err != nil { if err != nil {
@ -519,7 +519,7 @@ type RESTStorageProvider interface {
} }
// InstallAPIs will install the APIs for the restStorageProviders if they are enabled. // 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{} apiGroupsInfo := []*genericapiserver.APIGroupInfo{}
for _, restStorageBuilder := range restStorageProviders { 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 // MasterReceiver can be used to provide the master to a custom incoming server function
type MasterReceiver interface { type MasterReceiver interface {
SetMaster(m *controlplane.Master) SetMaster(m *controlplane.Instance)
} }
// MasterHolder implements // MasterHolder implements
type MasterHolder struct { type MasterHolder struct {
Initialized chan struct{} Initialized chan struct{}
M *controlplane.Master M *controlplane.Instance
} }
// SetMaster assigns the current master. // SetMaster assigns the current master.
func (h *MasterHolder) SetMaster(m *controlplane.Master) { func (h *MasterHolder) SetMaster(m *controlplane.Instance) {
h.M = m h.M = m
close(h.Initialized) close(h.Initialized)
} }
@ -124,8 +124,8 @@ func DefaultOpenAPIConfig() *openapicommon.Config {
} }
// startMasterOrDie starts a kubernetes master and an httpserver to handle api requests // 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) { func startMasterOrDie(masterConfig *controlplane.Config, incomingServer *httptest.Server, masterReceiver MasterReceiver) (*controlplane.Instance, *httptest.Server, CloseFunc) {
var m *controlplane.Master var m *controlplane.Instance
var s *httptest.Server var s *httptest.Server
// Ensure we log at least level 4 // Ensure we log at least level 4
@ -333,7 +333,7 @@ func NewMasterConfigWithOptions(opts *MasterConfigOptions) *controlplane.Config
type CloseFunc func() type CloseFunc func()
// RunAMaster starts a master with the provided config. // 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 { if masterConfig == nil {
masterConfig = NewMasterConfig() masterConfig = NewMasterConfig()
masterConfig.GenericConfig.EnableProfiling = true 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. // 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) return startMasterOrDie(masterConfig, s, masterReceiver)
} }

View File

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