wire in aggregation
Kubernetes-commit: 8e26fa25da6d3b1deb333fe2484f794795d1c6b9
This commit is contained in:
parent
8c644986dc
commit
b3af46c0dc
|
@ -343,10 +343,6 @@ 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}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -309,6 +309,11 @@ func (s *GenericAPIServer) EffectiveSecurePort() int {
|
||||||
// installAPIResources is a private method for installing the REST storage backing each api groupversionresource
|
// installAPIResources is a private method for installing the REST storage backing each api groupversionresource
|
||||||
func (s *GenericAPIServer) installAPIResources(apiPrefix string, apiGroupInfo *APIGroupInfo) error {
|
func (s *GenericAPIServer) installAPIResources(apiPrefix string, apiGroupInfo *APIGroupInfo) error {
|
||||||
for _, groupVersion := range apiGroupInfo.GroupMeta.GroupVersions {
|
for _, groupVersion := range apiGroupInfo.GroupMeta.GroupVersions {
|
||||||
|
if len(apiGroupInfo.VersionedResourcesStorageMap[groupVersion.Version]) == 0 {
|
||||||
|
glog.Warningf("Skipping API %v because it has no resources.", groupVersion)
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
apiGroupVersion := s.getAPIGroupVersion(apiGroupInfo, groupVersion, apiPrefix)
|
apiGroupVersion := s.getAPIGroupVersion(apiGroupInfo, groupVersion, apiPrefix)
|
||||||
if apiGroupInfo.OptionsExternalVersion != nil {
|
if apiGroupInfo.OptionsExternalVersion != nil {
|
||||||
apiGroupVersion.OptionsExternalVersion = apiGroupInfo.OptionsExternalVersion
|
apiGroupVersion.OptionsExternalVersion = apiGroupInfo.OptionsExternalVersion
|
||||||
|
|
|
@ -51,13 +51,17 @@ func (m *PathRecorderMux) ListedPaths() []string {
|
||||||
return handledPaths
|
return handledPaths
|
||||||
}
|
}
|
||||||
|
|
||||||
// Handle registers the handler for the given pattern.
|
func (m *PathRecorderMux) trackCallers(path string) {
|
||||||
// If a handler already exists for pattern, Handle panics.
|
|
||||||
func (m *PathRecorderMux) Handle(path string, handler http.Handler) {
|
|
||||||
if existingStack, ok := m.pathStacks[path]; ok {
|
if existingStack, ok := m.pathStacks[path]; ok {
|
||||||
utilruntime.HandleError(fmt.Errorf("registered %q from %v", path, existingStack))
|
utilruntime.HandleError(fmt.Errorf("registered %q from %v", path, existingStack))
|
||||||
}
|
}
|
||||||
m.pathStacks[path] = string(debug.Stack())
|
m.pathStacks[path] = string(debug.Stack())
|
||||||
|
}
|
||||||
|
|
||||||
|
// Handle registers the handler for the given pattern.
|
||||||
|
// If a handler already exists for pattern, Handle panics.
|
||||||
|
func (m *PathRecorderMux) Handle(path string, handler http.Handler) {
|
||||||
|
m.trackCallers(path)
|
||||||
|
|
||||||
m.exposedPaths = append(m.exposedPaths, path)
|
m.exposedPaths = append(m.exposedPaths, path)
|
||||||
m.mux.Handle(path, handler)
|
m.mux.Handle(path, handler)
|
||||||
|
@ -66,10 +70,7 @@ func (m *PathRecorderMux) Handle(path string, handler http.Handler) {
|
||||||
// HandleFunc registers the handler function for the given pattern.
|
// HandleFunc registers the handler function for the given pattern.
|
||||||
// If a handler already exists for pattern, Handle panics.
|
// If a handler already exists for pattern, Handle panics.
|
||||||
func (m *PathRecorderMux) HandleFunc(path string, handler func(http.ResponseWriter, *http.Request)) {
|
func (m *PathRecorderMux) HandleFunc(path string, handler func(http.ResponseWriter, *http.Request)) {
|
||||||
if existingStack, ok := m.pathStacks[path]; ok {
|
m.trackCallers(path)
|
||||||
utilruntime.HandleError(fmt.Errorf("registered %q from %v", path, existingStack))
|
|
||||||
}
|
|
||||||
m.pathStacks[path] = string(debug.Stack())
|
|
||||||
|
|
||||||
m.exposedPaths = append(m.exposedPaths, path)
|
m.exposedPaths = append(m.exposedPaths, path)
|
||||||
m.mux.HandleFunc(path, handler)
|
m.mux.HandleFunc(path, handler)
|
||||||
|
@ -78,21 +79,15 @@ func (m *PathRecorderMux) HandleFunc(path string, handler func(http.ResponseWrit
|
||||||
// UnlistedHandle registers the handler for the given pattern, but doesn't list it.
|
// UnlistedHandle registers the handler for the given pattern, but doesn't list it.
|
||||||
// If a handler already exists for pattern, Handle panics.
|
// If a handler already exists for pattern, Handle panics.
|
||||||
func (m *PathRecorderMux) UnlistedHandle(path string, handler http.Handler) {
|
func (m *PathRecorderMux) UnlistedHandle(path string, handler http.Handler) {
|
||||||
if existingStack, ok := m.pathStacks[path]; ok {
|
m.trackCallers(path)
|
||||||
utilruntime.HandleError(fmt.Errorf("registered %q from %v", path, existingStack))
|
|
||||||
}
|
|
||||||
m.pathStacks[path] = string(debug.Stack())
|
|
||||||
m.mux.Handle(path, handler)
|
|
||||||
|
|
||||||
|
m.mux.Handle(path, handler)
|
||||||
}
|
}
|
||||||
|
|
||||||
// UnlistedHandleFunc registers the handler function for the given pattern, but doesn't list it.
|
// UnlistedHandleFunc registers the handler function for the given pattern, but doesn't list it.
|
||||||
// If a handler already exists for pattern, Handle panics.
|
// If a handler already exists for pattern, Handle panics.
|
||||||
func (m *PathRecorderMux) UnlistedHandleFunc(path string, handler func(http.ResponseWriter, *http.Request)) {
|
func (m *PathRecorderMux) UnlistedHandleFunc(path string, handler func(http.ResponseWriter, *http.Request)) {
|
||||||
if existingStack, ok := m.pathStacks[path]; ok {
|
m.trackCallers(path)
|
||||||
utilruntime.HandleError(fmt.Errorf("registered %q from %v", path, existingStack))
|
|
||||||
}
|
|
||||||
m.pathStacks[path] = string(debug.Stack())
|
|
||||||
|
|
||||||
m.mux.HandleFunc(path, handler)
|
m.mux.HandleFunc(path, handler)
|
||||||
}
|
}
|
||||||
|
|
|
@ -107,7 +107,7 @@ func (s *EtcdOptions) AddFlags(fs *pflag.FlagSet) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *EtcdOptions) ApplyTo(c *server.Config) error {
|
func (s *EtcdOptions) ApplyTo(c *server.Config) error {
|
||||||
c.RESTOptionsGetter = &simpleRestOptionsFactory{Options: *s}
|
c.RESTOptionsGetter = &SimpleRestOptionsFactory{Options: *s}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -116,11 +116,11 @@ func (s *EtcdOptions) ApplyWithStorageFactoryTo(factory serverstorage.StorageFac
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
type simpleRestOptionsFactory struct {
|
type SimpleRestOptionsFactory struct {
|
||||||
Options EtcdOptions
|
Options EtcdOptions
|
||||||
}
|
}
|
||||||
|
|
||||||
func (f *simpleRestOptionsFactory) GetRESTOptions(resource schema.GroupResource) (generic.RESTOptions, error) {
|
func (f *SimpleRestOptionsFactory) GetRESTOptions(resource schema.GroupResource) (generic.RESTOptions, error) {
|
||||||
ret := generic.RESTOptions{
|
ret := generic.RESTOptions{
|
||||||
StorageConfig: &f.Options.StorageConfig,
|
StorageConfig: &f.Options.StorageConfig,
|
||||||
Decorator: generic.UndecoratedStorage,
|
Decorator: generic.UndecoratedStorage,
|
||||||
|
|
Loading…
Reference in New Issue