diff --git a/cmd/kube-apiserver/app/server.go b/cmd/kube-apiserver/app/server.go index 3b51fc6fa42..ad26e598309 100644 --- a/cmd/kube-apiserver/app/server.go +++ b/cmd/kube-apiserver/app/server.go @@ -419,7 +419,6 @@ func BuildGenericConfig(s *options.ServerRunOptions, proxyTransport *http.Transp genericConfig.OpenAPIConfig.PostProcessSpec = postProcessOpenAPISpecForBackwardCompatibility genericConfig.OpenAPIConfig.Info.Title = "Kubernetes" genericConfig.SwaggerConfig = genericapiserver.DefaultSwaggerConfig() - genericConfig.EnableMetrics = true genericConfig.LongRunningFunc = filters.BasicLongRunningRequestCheck( sets.NewString("watch", "proxy"), sets.NewString("attach", "exec", "proxy", "log", "portforward"), diff --git a/pkg/master/master.go b/pkg/master/master.go index d90dadfda64..d0bcd20b968 100644 --- a/pkg/master/master.go +++ b/pkg/master/master.go @@ -284,9 +284,6 @@ func (cfg *Config) Complete(informers informers.SharedInformerFactory) Completed c.ExtraConfig.EndpointReconcilerConfig.Reconciler = cfg.createEndpointReconciler() } - // this has always been hardcoded true in the past - c.GenericConfig.EnableMetrics = true - return CompletedConfig{&c} } diff --git a/pkg/master/master_test.go b/pkg/master/master_test.go index bb4681e3b70..0696d164cd3 100644 --- a/pkg/master/master_test.go +++ b/pkg/master/master_test.go @@ -108,7 +108,6 @@ func setUp(t *testing.T) (*etcdtesting.EtcdTestServer, Config, informers.SharedI config.GenericConfig.LegacyAPIGroupPrefixes = sets.NewString("/api") config.GenericConfig.RequestContextMapper = genericapirequest.NewRequestContextMapper() config.GenericConfig.LoopbackClientConfig = &restclient.Config{APIPath: "/api", ContentConfig: restclient.ContentConfig{NegotiatedSerializer: legacyscheme.Codecs}} - config.GenericConfig.EnableMetrics = true config.ExtraConfig.EnableCoreControllers = false config.ExtraConfig.KubeletClientConfig = kubeletclient.KubeletClientConfig{Port: 10250} config.ExtraConfig.ProxyTransport = utilnet.SetTransportDefaults(&http.Transport{ diff --git a/staging/src/k8s.io/apiserver/pkg/server/config.go b/staging/src/k8s.io/apiserver/pkg/server/config.go index 2f4c48b45a2..bcf1c470fb0 100644 --- a/staging/src/k8s.io/apiserver/pkg/server/config.go +++ b/staging/src/k8s.io/apiserver/pkg/server/config.go @@ -262,6 +262,7 @@ func NewConfig(codecs serializer.CodecFactory) *Config { EnableIndex: true, EnableDiscovery: true, EnableProfiling: true, + EnableMetrics: true, MaxRequestsInFlight: 400, MaxMutatingRequestsInFlight: 200, RequestTimeout: time.Duration(60) * time.Second, diff --git a/staging/src/k8s.io/apiserver/pkg/server/config_test.go b/staging/src/k8s.io/apiserver/pkg/server/config_test.go index 381318c8deb..b9b8fafc9da 100644 --- a/staging/src/k8s.io/apiserver/pkg/server/config_test.go +++ b/staging/src/k8s.io/apiserver/pkg/server/config_test.go @@ -109,6 +109,7 @@ func TestNewWithDelegate(t *testing.T) { "/healthz/poststarthook/generic-apiserver-start-informers", "/healthz/poststarthook/wrapping-post-start-hook", "/healthz/wrapping-health", + "/metrics", "/swaggerapi" ] }`, t) diff --git a/test/integration/defaulttolerationseconds/defaulttolerationseconds_test.go b/test/integration/defaulttolerationseconds/defaulttolerationseconds_test.go index 463ec7641f7..d5ae63b9ebe 100644 --- a/test/integration/defaulttolerationseconds/defaulttolerationseconds_test.go +++ b/test/integration/defaulttolerationseconds/defaulttolerationseconds_test.go @@ -33,7 +33,6 @@ import ( func TestAdmission(t *testing.T) { masterConfig := framework.NewMasterConfig() masterConfig.GenericConfig.EnableProfiling = true - masterConfig.GenericConfig.EnableMetrics = true masterConfig.GenericConfig.AdmissionControl = defaulttolerationseconds.NewDefaultTolerationSeconds() _, s, closeFn := framework.RunAMaster(masterConfig) defer closeFn() diff --git a/test/integration/framework/master_utils.go b/test/integration/framework/master_utils.go index 8337a9161ed..13e52f48288 100644 --- a/test/integration/framework/master_utils.go +++ b/test/integration/framework/master_utils.go @@ -124,8 +124,6 @@ func startMasterOrDie(masterConfig *master.Config, incomingServer *httptest.Serv if masterConfig == nil { masterConfig = NewMasterConfig() - masterConfig.GenericConfig.EnableProfiling = true - masterConfig.GenericConfig.EnableMetrics = true masterConfig.GenericConfig.OpenAPIConfig = genericapiserver.DefaultOpenAPIConfig(openapi.GetOpenAPIDefinitions, legacyscheme.Scheme) masterConfig.GenericConfig.OpenAPIConfig.Info = &spec.Info{ InfoProps: spec.InfoProps{ @@ -218,6 +216,15 @@ func startMasterOrDie(masterConfig *master.Config, incomingServer *httptest.Serv return m, s, closeFn } +// Returns the master config appropriate for most integration tests. +func NewIntegrationTestMasterConfig() *master.Config { + masterConfig := NewMasterConfig() + masterConfig.ExtraConfig.EnableCoreControllers = true + masterConfig.GenericConfig.PublicAddress = net.ParseIP("192.168.10.4") + masterConfig.ExtraConfig.APIResourceConfigSource = master.DefaultAPIResourceConfigSource() + return masterConfig +} + // Returns a basic master config. func NewMasterConfig() *master.Config { // This causes the integration tests to exercise the etcd @@ -280,7 +287,6 @@ func NewMasterConfig() *master.Config { kubeVersion := version.Get() genericConfig.Version = &kubeVersion genericConfig.Authorization.Authorizer = authorizerfactory.NewAlwaysAllowAuthorizer() - genericConfig.EnableMetrics = true err := etcdOptions.ApplyWithStorageFactoryTo(storageFactory, genericConfig) if err != nil { @@ -300,15 +306,6 @@ func NewMasterConfig() *master.Config { } } -// Returns the master config appropriate for most integration tests. -func NewIntegrationTestMasterConfig() *master.Config { - masterConfig := NewMasterConfig() - masterConfig.ExtraConfig.EnableCoreControllers = true - masterConfig.GenericConfig.PublicAddress = net.ParseIP("192.168.10.4") - masterConfig.ExtraConfig.APIResourceConfigSource = master.DefaultAPIResourceConfigSource() - return masterConfig -} - // CloseFunc can be called to cleanup the master type CloseFunc func() @@ -316,7 +313,6 @@ func RunAMaster(masterConfig *master.Config) (*master.Master, *httptest.Server, if masterConfig == nil { masterConfig = NewMasterConfig() masterConfig.GenericConfig.EnableProfiling = true - masterConfig.GenericConfig.EnableMetrics = true } return startMasterOrDie(masterConfig, nil, nil) }