Commit 1fa91fdd authored by Kubernetes Submit Queue's avatar Kubernetes Submit Queue Committed by GitHub

Merge pull request #42900 from deads2k/agg-26-fallthrough

Automatic merge from submit-queue rewire aggregation handling chain to be normal Uses https://github.com/kubernetes/kubernetes/pull/42886 to allow the aggregator to be "normal" as far as the handling chain goes. This will allow for cleaner composition. @kubernetes/sig-api-machinery-misc
parents 59992965 b28966b4
...@@ -91,6 +91,7 @@ type Config struct { ...@@ -91,6 +91,7 @@ type Config struct {
EnableSwaggerUI bool EnableSwaggerUI bool
EnableIndex bool EnableIndex bool
EnableProfiling bool EnableProfiling bool
EnableDiscovery bool
// Requires generic profiling enabled // Requires generic profiling enabled
EnableContentionProfiling bool EnableContentionProfiling bool
EnableMetrics bool EnableMetrics bool
...@@ -203,6 +204,7 @@ func NewConfig() *Config { ...@@ -203,6 +204,7 @@ func NewConfig() *Config {
LegacyAPIGroupPrefixes: sets.NewString(DefaultLegacyAPIPrefix), LegacyAPIGroupPrefixes: sets.NewString(DefaultLegacyAPIPrefix),
HealthzChecks: []healthz.HealthzChecker{healthz.PingHealthz}, HealthzChecks: []healthz.HealthzChecker{healthz.PingHealthz},
EnableIndex: true, EnableIndex: true,
EnableDiscovery: true,
EnableProfiling: true, EnableProfiling: true,
MaxRequestsInFlight: 400, MaxRequestsInFlight: 400,
MaxMutatingRequestsInFlight: 200, MaxMutatingRequestsInFlight: 200,
...@@ -345,6 +347,10 @@ func (c *Config) Complete() completedConfig { ...@@ -345,6 +347,10 @@ func (c *Config) Complete() completedConfig {
c.FallThroughHandler = mux.NewPathRecorderMux() c.FallThroughHandler = mux.NewPathRecorderMux()
} }
if c.FallThroughHandler == nil {
c.FallThroughHandler = mux.NewPathRecorderMux()
}
return completedConfig{c} return completedConfig{c}
} }
...@@ -535,7 +541,10 @@ func installAPI(s *GenericAPIServer, c *Config, delegate http.Handler) { ...@@ -535,7 +541,10 @@ func installAPI(s *GenericAPIServer, c *Config, delegate http.Handler) {
} }
} }
routes.Version{Version: c.Version}.Install(s.HandlerContainer) routes.Version{Version: c.Version}.Install(s.HandlerContainer)
s.HandlerContainer.Add(s.DynamicApisDiscovery())
if c.EnableDiscovery {
s.HandlerContainer.Add(s.DynamicApisDiscovery())
}
} }
func NewRequestInfoResolver(c *Config) *apirequest.RequestInfoFactory { func NewRequestInfoResolver(c *Config) *apirequest.RequestInfoFactory {
......
...@@ -189,6 +189,30 @@ func (s *GenericAPIServer) ListedPaths() []string { ...@@ -189,6 +189,30 @@ func (s *GenericAPIServer) ListedPaths() []string {
return s.listedPathProvider.ListedPaths() return s.listedPathProvider.ListedPaths()
} }
var EmptyDelegate = emptyDelegate{
requestContextMapper: apirequest.NewRequestContextMapper(),
}
type emptyDelegate struct {
requestContextMapper apirequest.RequestContextMapper
}
func (s emptyDelegate) UnprotectedHandler() http.Handler {
return http.NotFoundHandler()
}
func (s emptyDelegate) PostStartHooks() map[string]postStartHookEntry {
return map[string]postStartHookEntry{}
}
func (s emptyDelegate) HealthzChecks() []healthz.HealthzChecker {
return []healthz.HealthzChecker{}
}
func (s emptyDelegate) ListedPaths() []string {
return []string{}
}
func (s emptyDelegate) RequestContextMapper() apirequest.RequestContextMapper {
return s.requestContextMapper
}
func init() { func init() {
// Send correct mime type for .svg files. // Send correct mime type for .svg files.
// TODO: remove when https://github.com/golang/go/commit/21e47d831bafb59f22b1ea8098f709677ec8ce33 // TODO: remove when https://github.com/golang/go/commit/21e47d831bafb59f22b1ea8098f709677ec8ce33
......
...@@ -159,7 +159,7 @@ func (o AggregatorOptions) RunAggregator(stopCh <-chan struct{}) error { ...@@ -159,7 +159,7 @@ func (o AggregatorOptions) RunAggregator(stopCh <-chan struct{}) error {
return err return err
} }
server, err := config.Complete().New(stopCh) server, err := config.Complete().NewWithDelegate(genericapiserver.EmptyDelegate, stopCh)
if err != nil { if err != nil {
return err return err
} }
......
...@@ -15496,13 +15496,11 @@ go_library( ...@@ -15496,13 +15496,11 @@ go_library(
"//vendor:k8s.io/apimachinery/pkg/util/runtime", "//vendor:k8s.io/apimachinery/pkg/util/runtime",
"//vendor:k8s.io/apimachinery/pkg/util/sets", "//vendor:k8s.io/apimachinery/pkg/util/sets",
"//vendor:k8s.io/apimachinery/pkg/util/wait", "//vendor:k8s.io/apimachinery/pkg/util/wait",
"//vendor:k8s.io/apiserver/pkg/endpoints/filters",
"//vendor:k8s.io/apiserver/pkg/endpoints/handlers/responsewriters", "//vendor:k8s.io/apiserver/pkg/endpoints/handlers/responsewriters",
"//vendor:k8s.io/apiserver/pkg/endpoints/request", "//vendor:k8s.io/apiserver/pkg/endpoints/request",
"//vendor:k8s.io/apiserver/pkg/registry/generic/rest", "//vendor:k8s.io/apiserver/pkg/registry/generic/rest",
"//vendor:k8s.io/apiserver/pkg/registry/rest", "//vendor:k8s.io/apiserver/pkg/registry/rest",
"//vendor:k8s.io/apiserver/pkg/server", "//vendor:k8s.io/apiserver/pkg/server",
"//vendor:k8s.io/apiserver/pkg/server/filters",
"//vendor:k8s.io/client-go/informers", "//vendor:k8s.io/client-go/informers",
"//vendor:k8s.io/client-go/kubernetes", "//vendor:k8s.io/client-go/kubernetes",
"//vendor:k8s.io/client-go/listers/core/v1", "//vendor:k8s.io/client-go/listers/core/v1",
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment