mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-05 02:09:56 +00:00
Merge pull request #30050 from ping035627/ping035627-patch-0804
Automatic merge from submit-queue Correct the url in comment and optimise the code style The PR modified two aspects: 1) Correct the url in comment, the original url can't be accessed; 2) Optimise the code style according to the go style guide.
This commit is contained in:
commit
e800c391f5
@ -466,8 +466,8 @@ func (s *GenericAPIServer) init(c *Config) {
|
|||||||
handler := http.Handler(s.mux.(*http.ServeMux))
|
handler := http.Handler(s.mux.(*http.ServeMux))
|
||||||
|
|
||||||
// TODO: handle CORS and auth using go-restful
|
// TODO: handle CORS and auth using go-restful
|
||||||
// See github.com/emicklei/go-restful/blob/GenericAPIServer/examples/restful-CORS-filter.go, and
|
// See github.com/emicklei/go-restful/blob/master/examples/restful-CORS-filter.go, and
|
||||||
// github.com/emicklei/go-restful/blob/GenericAPIServer/examples/restful-basic-authentication.go
|
// github.com/emicklei/go-restful/blob/master/examples/restful-basic-authentication.go
|
||||||
|
|
||||||
if len(c.CorsAllowedOriginList) > 0 {
|
if len(c.CorsAllowedOriginList) > 0 {
|
||||||
allowedOriginRegexps, err := util.CompileRegexps(c.CorsAllowedOriginList)
|
allowedOriginRegexps, err := util.CompileRegexps(c.CorsAllowedOriginList)
|
||||||
@ -507,17 +507,18 @@ func (s *GenericAPIServer) init(c *Config) {
|
|||||||
s.Handler = handler
|
s.Handler = handler
|
||||||
|
|
||||||
// After all wrapping is done, put a context filter around both handlers
|
// After all wrapping is done, put a context filter around both handlers
|
||||||
if handler, err := api.NewRequestContextFilter(s.RequestContextMapper, s.Handler); err != nil {
|
var err error
|
||||||
|
handler, err = api.NewRequestContextFilter(s.RequestContextMapper, s.Handler)
|
||||||
|
if err != nil {
|
||||||
glog.Fatalf("Could not initialize request context filter for s.Handler: %v", err)
|
glog.Fatalf("Could not initialize request context filter for s.Handler: %v", err)
|
||||||
} else {
|
|
||||||
s.Handler = handler
|
|
||||||
}
|
}
|
||||||
|
s.Handler = handler
|
||||||
|
|
||||||
if handler, err := api.NewRequestContextFilter(s.RequestContextMapper, s.InsecureHandler); err != nil {
|
handler, err = api.NewRequestContextFilter(s.RequestContextMapper, s.InsecureHandler)
|
||||||
|
if err != nil {
|
||||||
glog.Fatalf("Could not initialize request context filter for s.InsecureHandler: %v", err)
|
glog.Fatalf("Could not initialize request context filter for s.InsecureHandler: %v", err)
|
||||||
} else {
|
|
||||||
s.InsecureHandler = handler
|
|
||||||
}
|
}
|
||||||
|
s.InsecureHandler = handler
|
||||||
|
|
||||||
s.installGroupsDiscoveryHandler()
|
s.installGroupsDiscoveryHandler()
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user