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
fdfe42ea
Commit
fdfe42ea
authored
Apr 26, 2016
by
jianhuiz
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
move install of version handler to genericapiserver
parent
7e430f54
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
22 additions
and
25 deletions
+22
-25
resourceListing.json
api/swagger-spec/resourceListing.json
+4
-4
server_test.go
federation/cmd/federated-apiserver/app/server_test.go
+9
-0
apiserver.go
pkg/apiserver/apiserver.go
+3
-6
apiserver_test.go
pkg/apiserver/apiserver_test.go
+3
-8
genericapiserver.go
pkg/genericapiserver/genericapiserver.go
+2
-0
master.go
pkg/master/master.go
+1
-7
No files found.
api/swagger-spec/resourceListing.json
View file @
fdfe42ea
...
...
@@ -2,14 +2,14 @@
"swaggerVersion"
:
"1.2"
,
"apis"
:
[
{
"path"
:
"/apis"
,
"description"
:
"get available API versions"
},
{
"path"
:
"/version"
,
"description"
:
"git code version from which this is built"
},
{
"path"
:
"/apis"
,
"description"
:
"get available API versions"
},
{
"path"
:
"/api/v1"
,
"description"
:
"API at /api/v1"
},
...
...
federation/cmd/federated-apiserver/app/server_test.go
View file @
fdfe42ea
...
...
@@ -92,6 +92,7 @@ func TestRun(t *testing.T) {
t
.
Fatalf
(
"%v"
,
err
)
}
testSwaggerSpec
(
t
)
testSupport
(
t
)
testAPIGroupList
(
t
)
testAPIGroup
(
t
)
testAPIResourceList
(
t
)
...
...
@@ -131,6 +132,14 @@ func testSwaggerSpec(t *testing.T) {
}
}
func
testSupport
(
t
*
testing
.
T
)
{
serverURL
:=
serverIP
+
"/version"
_
,
err
:=
readResponse
(
serverURL
)
if
err
!=
nil
{
t
.
Fatalf
(
"%v"
,
err
)
}
}
func
findGroup
(
groups
[]
unversioned
.
APIGroup
,
groupName
string
)
*
unversioned
.
APIGroup
{
for
_
,
group
:=
range
groups
{
if
group
.
Name
==
groupName
{
...
...
pkg/apiserver/apiserver.go
View file @
fdfe42ea
...
...
@@ -36,7 +36,6 @@ import (
"k8s.io/kubernetes/pkg/api/rest"
"k8s.io/kubernetes/pkg/api/unversioned"
"k8s.io/kubernetes/pkg/apiserver/metrics"
"k8s.io/kubernetes/pkg/healthz"
"k8s.io/kubernetes/pkg/runtime"
utilerrors
"k8s.io/kubernetes/pkg/util/errors"
"k8s.io/kubernetes/pkg/util/flushwriter"
...
...
@@ -163,10 +162,8 @@ func (g *APIGroupVersion) newInstaller() *APIInstaller {
}
// TODO: document all handlers
// InstallSupport registers the APIServer support functions
func
InstallSupport
(
mux
Mux
,
checks
...
healthz
.
HealthzChecker
)
[]
*
restful
.
WebService
{
// TODO: convert healthz and metrics to restful and remove container arg
healthz
.
InstallHandler
(
mux
,
checks
...
)
// InstallVersionHandler registers the APIServer's `/version` handler
func
InstallVersionHandler
(
mux
Mux
,
container
*
restful
.
Container
)
{
// Set up a service to return the git code version.
versionWS
:=
new
(
restful
.
WebService
)
...
...
@@ -179,7 +176,7 @@ func InstallSupport(mux Mux, checks ...healthz.HealthzChecker) []*restful.WebSer
Produces
(
restful
.
MIME_JSON
)
.
Consumes
(
restful
.
MIME_JSON
))
return
[]
*
restful
.
WebService
{
versionWS
}
container
.
Add
(
versionWS
)
}
// InstallLogsSupport registers the APIServer log support function into a mux.
...
...
pkg/apiserver/apiserver_test.go
View file @
fdfe42ea
...
...
@@ -317,10 +317,8 @@ func handleInternal(storage map[string]rest.Storage, admissionControl admission.
}
}
webservices
:=
InstallSupport
(
mux
)
for
i
:=
range
webservices
{
container
.
Add
(
webservices
[
i
])
}
InstallVersionHandler
(
mux
,
container
)
return
&
defaultAPIServer
{
mux
,
container
}
}
...
...
@@ -3263,10 +3261,7 @@ func TestXGSubresource(t *testing.T) {
panic
(
fmt
.
Sprintf
(
"unable to install container %s: %v"
,
group
.
GroupVersion
,
err
))
}
webservices
:=
InstallSupport
(
mux
)
for
i
:=
range
webservices
{
container
.
Add
(
webservices
[
i
])
}
InstallVersionHandler
(
mux
,
container
)
handler
:=
defaultAPIServer
{
mux
,
container
}
server
:=
httptest
.
NewServer
(
handler
)
...
...
pkg/genericapiserver/genericapiserver.go
View file @
fdfe42ea
...
...
@@ -454,6 +454,8 @@ func (s *GenericAPIServer) init(c *Config) {
s
.
mux
.
HandleFunc
(
"/debug/pprof/symbol"
,
pprof
.
Symbol
)
}
apiserver
.
InstallVersionHandler
(
s
.
MuxHelper
,
s
.
HandlerContainer
)
handler
:=
http
.
Handler
(
s
.
mux
.
(
*
http
.
ServeMux
))
// TODO: handle CORS and auth using go-restful
...
...
pkg/master/master.go
View file @
fdfe42ea
...
...
@@ -226,9 +226,7 @@ func (m *Master) InstallAPIs(c *Config) {
Help
:
"The time since the last successful synchronization of the SSH tunnels for proxy requests."
,
},
func
()
float64
{
return
float64
(
m
.
tunneler
.
SecondsSinceSync
())
})
}
// TODO(nikhiljindal): Refactor generic parts of support services (like /versions) to genericapiserver.
webservices
:=
apiserver
.
InstallSupport
(
m
.
MuxHelper
,
healthzChecks
...
)
healthz
.
InstallHandler
(
m
.
MuxHelper
,
healthzChecks
...
)
if
c
.
EnableProfiling
{
m
.
MuxHelper
.
HandleFunc
(
"/metrics"
,
MetricsWithReset
)
...
...
@@ -236,10 +234,6 @@ func (m *Master) InstallAPIs(c *Config) {
m
.
MuxHelper
.
HandleFunc
(
"/metrics"
,
defaultMetricsHandler
)
}
for
i
:=
range
webservices
{
m
.
HandlerContainer
.
Add
(
webservices
[
i
])
}
// allGroups records all supported groups at /apis
allGroups
:=
[]
unversioned
.
APIGroup
{}
...
...
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