Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
K
k3s
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jacklull
k3s
Commits
e49fb2f1
Commit
e49fb2f1
authored
Dec 16, 2016
by
Dr. Stefan Schimanski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
genericapiserver: rename SecretRoutes -> UnlistedRoutes
parent
df7e711c
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
13 additions
and
13 deletions
+13
-13
apiserver.go
cmd/kubernetes-discovery/pkg/apiserver/apiserver.go
+2
-2
genericapiserver_test.go
pkg/genericapiserver/genericapiserver_test.go
+1
-1
container.go
pkg/genericapiserver/mux/container.go
+3
-3
container_test.go
pkg/genericapiserver/mux/container_test.go
+2
-2
openapi.go
pkg/genericapiserver/openapi/openapi.go
+1
-1
index.go
pkg/genericapiserver/routes/index.go
+1
-1
profiling.go
pkg/genericapiserver/routes/profiling.go
+3
-3
No files found.
cmd/kubernetes-discovery/pkg/apiserver/apiserver.go
View file @
e49fb2f1
...
@@ -227,8 +227,8 @@ func (s *APIDiscoveryServer) AddAPIService(apiService *apiregistration.APIServic
...
@@ -227,8 +227,8 @@ func (s *APIDiscoveryServer) AddAPIService(apiService *apiregistration.APIServic
lister
:
s
.
lister
,
lister
:
s
.
lister
,
}
}
// discovery is protected
// discovery is protected
s
.
GenericAPIServer
.
HandlerContainer
.
Secret
Routes
.
Handle
(
groupPath
,
groupDiscoveryHandler
)
s
.
GenericAPIServer
.
HandlerContainer
.
Unlisted
Routes
.
Handle
(
groupPath
,
groupDiscoveryHandler
)
s
.
GenericAPIServer
.
HandlerContainer
.
Secret
Routes
.
Handle
(
groupPath
+
"/"
,
groupDiscoveryHandler
)
s
.
GenericAPIServer
.
HandlerContainer
.
Unlisted
Routes
.
Handle
(
groupPath
+
"/"
,
groupDiscoveryHandler
)
}
}
...
...
pkg/genericapiserver/genericapiserver_test.go
View file @
e49fb2f1
...
@@ -323,7 +323,7 @@ func TestCustomHandlerChain(t *testing.T) {
...
@@ -323,7 +323,7 @@ func TestCustomHandlerChain(t *testing.T) {
}
}
s
.
HandlerContainer
.
NonSwaggerRoutes
.
Handle
(
"/nonswagger"
,
handler
)
s
.
HandlerContainer
.
NonSwaggerRoutes
.
Handle
(
"/nonswagger"
,
handler
)
s
.
HandlerContainer
.
Secret
Routes
.
Handle
(
"/secret"
,
handler
)
s
.
HandlerContainer
.
Unlisted
Routes
.
Handle
(
"/secret"
,
handler
)
type
Test
struct
{
type
Test
struct
{
handler
http
.
Handler
handler
http
.
Handler
...
...
pkg/genericapiserver/mux/container.go
View file @
e49fb2f1
...
@@ -33,8 +33,8 @@ type APIContainer struct {
...
@@ -33,8 +33,8 @@ type APIContainer struct {
// NonSwaggerRoutes are recorded and are visible at /, but do not show up in Swagger.
// NonSwaggerRoutes are recorded and are visible at /, but do not show up in Swagger.
NonSwaggerRoutes
PathRecorderMux
NonSwaggerRoutes
PathRecorderMux
//
SecretRoutes are not recorded, a
re not visible at / and do not show up in Swagger.
//
UnlistedRoutes are not recorded, therefo
re not visible at / and do not show up in Swagger.
Secret
Routes
*
http
.
ServeMux
Unlisted
Routes
*
http
.
ServeMux
}
}
// NewAPIContainer constructs a new container for APIs
// NewAPIContainer constructs a new container for APIs
...
@@ -44,7 +44,7 @@ func NewAPIContainer(mux *http.ServeMux, s runtime.NegotiatedSerializer) *APICon
...
@@ -44,7 +44,7 @@ func NewAPIContainer(mux *http.ServeMux, s runtime.NegotiatedSerializer) *APICon
NonSwaggerRoutes
:
PathRecorderMux
{
NonSwaggerRoutes
:
PathRecorderMux
{
mux
:
mux
,
mux
:
mux
,
},
},
Secret
Routes
:
mux
,
Unlisted
Routes
:
mux
,
}
}
c
.
Container
.
ServeMux
=
mux
c
.
Container
.
ServeMux
=
mux
c
.
Container
.
Router
(
restful
.
CurlyRouter
{})
// e.g. for proxy/{kind}/{name}/{*}
c
.
Container
.
Router
(
restful
.
CurlyRouter
{})
// e.g. for proxy/{kind}/{name}/{*}
...
...
pkg/genericapiserver/mux/container_test.go
View file @
e49fb2f1
...
@@ -26,14 +26,14 @@ import (
...
@@ -26,14 +26,14 @@ import (
func
TestNewAPIContainer
(
t
*
testing
.
T
)
{
func
TestNewAPIContainer
(
t
*
testing
.
T
)
{
mux
:=
http
.
NewServeMux
()
mux
:=
http
.
NewServeMux
()
c
:=
NewAPIContainer
(
mux
,
nil
)
c
:=
NewAPIContainer
(
mux
,
nil
)
assert
.
Equal
(
t
,
mux
,
c
.
SecretRoutes
,
"Secret
Routes ServeMux's do not match"
)
assert
.
Equal
(
t
,
mux
,
c
.
UnlistedRoutes
,
"Unlisted
Routes ServeMux's do not match"
)
assert
.
Equal
(
t
,
mux
,
c
.
Container
.
ServeMux
,
"Container ServeMux's do not match"
)
assert
.
Equal
(
t
,
mux
,
c
.
Container
.
ServeMux
,
"Container ServeMux's do not match"
)
}
}
func
TestSecretHandlers
(
t
*
testing
.
T
)
{
func
TestSecretHandlers
(
t
*
testing
.
T
)
{
mux
:=
http
.
NewServeMux
()
mux
:=
http
.
NewServeMux
()
c
:=
NewAPIContainer
(
mux
,
nil
)
c
:=
NewAPIContainer
(
mux
,
nil
)
c
.
Secret
Routes
.
HandleFunc
(
"/secret"
,
func
(
http
.
ResponseWriter
,
*
http
.
Request
)
{})
c
.
Unlisted
Routes
.
HandleFunc
(
"/secret"
,
func
(
http
.
ResponseWriter
,
*
http
.
Request
)
{})
c
.
NonSwaggerRoutes
.
HandleFunc
(
"/nonswagger"
,
func
(
http
.
ResponseWriter
,
*
http
.
Request
)
{})
c
.
NonSwaggerRoutes
.
HandleFunc
(
"/nonswagger"
,
func
(
http
.
ResponseWriter
,
*
http
.
Request
)
{})
assert
.
NotContains
(
t
,
c
.
NonSwaggerRoutes
.
HandledPaths
(),
"/secret"
)
assert
.
NotContains
(
t
,
c
.
NonSwaggerRoutes
.
HandledPaths
(),
"/secret"
)
assert
.
Contains
(
t
,
c
.
NonSwaggerRoutes
.
HandledPaths
(),
"/nonswagger"
)
assert
.
Contains
(
t
,
c
.
NonSwaggerRoutes
.
HandledPaths
(),
"/nonswagger"
)
...
...
pkg/genericapiserver/openapi/openapi.go
View file @
e49fb2f1
...
@@ -62,7 +62,7 @@ func RegisterOpenAPIService(servePath string, webServices []*restful.WebService,
...
@@ -62,7 +62,7 @@ func RegisterOpenAPIService(servePath string, webServices []*restful.WebService,
return
err
return
err
}
}
container
.
Secret
Routes
.
HandleFunc
(
servePath
,
func
(
w
http
.
ResponseWriter
,
r
*
http
.
Request
)
{
container
.
Unlisted
Routes
.
HandleFunc
(
servePath
,
func
(
w
http
.
ResponseWriter
,
r
*
http
.
Request
)
{
resp
:=
restful
.
NewResponse
(
w
)
resp
:=
restful
.
NewResponse
(
w
)
if
r
.
URL
.
Path
!=
servePath
{
if
r
.
URL
.
Path
!=
servePath
{
resp
.
WriteErrorString
(
http
.
StatusNotFound
,
"Path not found!"
)
resp
.
WriteErrorString
(
http
.
StatusNotFound
,
"Path not found!"
)
...
...
pkg/genericapiserver/routes/index.go
View file @
e49fb2f1
...
@@ -30,7 +30,7 @@ type Index struct{}
...
@@ -30,7 +30,7 @@ type Index struct{}
// Install adds the Index webservice to the given mux.
// Install adds the Index webservice to the given mux.
func
(
i
Index
)
Install
(
c
*
mux
.
APIContainer
)
{
func
(
i
Index
)
Install
(
c
*
mux
.
APIContainer
)
{
c
.
Secret
Routes
.
HandleFunc
(
"/"
,
func
(
w
http
.
ResponseWriter
,
r
*
http
.
Request
)
{
c
.
Unlisted
Routes
.
HandleFunc
(
"/"
,
func
(
w
http
.
ResponseWriter
,
r
*
http
.
Request
)
{
status
:=
http
.
StatusOK
status
:=
http
.
StatusOK
if
r
.
URL
.
Path
!=
"/"
&&
r
.
URL
.
Path
!=
"/index.html"
{
if
r
.
URL
.
Path
!=
"/"
&&
r
.
URL
.
Path
!=
"/index.html"
{
// Since "/" matches all paths, handleIndex is called for all paths for which there is no handler registered.
// Since "/" matches all paths, handleIndex is called for all paths for which there is no handler registered.
...
...
pkg/genericapiserver/routes/profiling.go
View file @
e49fb2f1
...
@@ -27,7 +27,7 @@ type Profiling struct{}
...
@@ -27,7 +27,7 @@ type Profiling struct{}
// Install adds the Profiling webservice to the given mux.
// Install adds the Profiling webservice to the given mux.
func
(
d
Profiling
)
Install
(
c
*
mux
.
APIContainer
)
{
func
(
d
Profiling
)
Install
(
c
*
mux
.
APIContainer
)
{
c
.
Secret
Routes
.
HandleFunc
(
"/debug/pprof/"
,
pprof
.
Index
)
c
.
Unlisted
Routes
.
HandleFunc
(
"/debug/pprof/"
,
pprof
.
Index
)
c
.
Secret
Routes
.
HandleFunc
(
"/debug/pprof/profile"
,
pprof
.
Profile
)
c
.
Unlisted
Routes
.
HandleFunc
(
"/debug/pprof/profile"
,
pprof
.
Profile
)
c
.
Secret
Routes
.
HandleFunc
(
"/debug/pprof/symbol"
,
pprof
.
Symbol
)
c
.
Unlisted
Routes
.
HandleFunc
(
"/debug/pprof/symbol"
,
pprof
.
Symbol
)
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment