mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-30 15:05:27 +00:00
optimise the New function
Signed-off-by: PingWang <wang.ping5@zte.com.cn>
This commit is contained in:
parent
8f08cb3391
commit
97b4a6fa42
@ -372,16 +372,14 @@ func New(c *Config) (*GenericAPIServer, error) {
|
||||
apiGroupsForDiscovery: map[string]unversioned.APIGroup{},
|
||||
}
|
||||
|
||||
var handlerContainer *restful.Container
|
||||
if c.RestfulContainer != nil {
|
||||
s.mux = c.RestfulContainer.ServeMux
|
||||
handlerContainer = c.RestfulContainer
|
||||
s.HandlerContainer = c.RestfulContainer
|
||||
} else {
|
||||
mux := http.NewServeMux()
|
||||
s.mux = mux
|
||||
handlerContainer = NewHandlerContainer(mux, c.Serializer)
|
||||
s.HandlerContainer = NewHandlerContainer(mux, c.Serializer)
|
||||
}
|
||||
s.HandlerContainer = handlerContainer
|
||||
// Use CurlyRouter to be able to use regular expressions in paths. Regular expressions are required in paths for example for proxy (where the path is proxy/{kind}/{name}/{*})
|
||||
s.HandlerContainer.Router(restful.CurlyRouter{})
|
||||
s.MuxHelper = &apiserver.MuxHelper{Mux: s.mux, RegisteredPaths: []string{}}
|
||||
|
Loading…
Reference in New Issue
Block a user