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
1063903d
Commit
1063903d
authored
Sep 23, 2016
by
Kubernetes Submit Queue
Committed by
GitHub
Sep 23, 2016
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #33266 from sttts/sttts-one-installapigroups
Automatic merge from submit-queue Reduce genericapiserver api surface
parents
7144f54d
c727e276
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
9 additions
and
15 deletions
+9
-15
apiserver.go
examples/apiserver/apiserver.go
+1
-1
genericapiserver.go
pkg/genericapiserver/genericapiserver.go
+1
-11
genericapiserver_test.go
pkg/genericapiserver/genericapiserver_test.go
+3
-1
master.go
pkg/master/master.go
+4
-2
No files found.
examples/apiserver/apiserver.go
View file @
1063903d
...
@@ -98,7 +98,7 @@ func Run(serverOptions *genericoptions.ServerRunOptions) error {
...
@@ -98,7 +98,7 @@ func Run(serverOptions *genericoptions.ServerRunOptions) error {
Scheme
:
api
.
Scheme
,
Scheme
:
api
.
Scheme
,
NegotiatedSerializer
:
api
.
Codecs
,
NegotiatedSerializer
:
api
.
Codecs
,
}
}
if
err
:=
s
.
InstallAPIGroup
s
([]
genericapiserver
.
APIGroupInfo
{
apiGroupInfo
}
);
err
!=
nil
{
if
err
:=
s
.
InstallAPIGroup
(
&
apiGroupInfo
);
err
!=
nil
{
return
fmt
.
Errorf
(
"Error in installing API: %v"
,
err
)
return
fmt
.
Errorf
(
"Error in installing API: %v"
,
err
)
}
}
s
.
Run
(
serverOptions
)
s
.
Run
(
serverOptions
)
...
...
pkg/genericapiserver/genericapiserver.go
View file @
1063903d
...
@@ -216,16 +216,6 @@ func NewHandlerContainer(mux *http.ServeMux, s runtime.NegotiatedSerializer) *re
...
@@ -216,16 +216,6 @@ func NewHandlerContainer(mux *http.ServeMux, s runtime.NegotiatedSerializer) *re
return
container
return
container
}
}
// Exposes the given group versions in API. Helper method to install multiple group versions at once.
func
(
s
*
GenericAPIServer
)
InstallAPIGroups
(
groupsInfo
[]
APIGroupInfo
)
error
{
for
_
,
apiGroupInfo
:=
range
groupsInfo
{
if
err
:=
s
.
InstallAPIGroup
(
&
apiGroupInfo
);
err
!=
nil
{
return
err
}
}
return
nil
}
// Installs handler at /apis to list all group versions for discovery
// Installs handler at /apis to list all group versions for discovery
func
(
s
*
GenericAPIServer
)
installGroupsDiscoveryHandler
()
{
func
(
s
*
GenericAPIServer
)
installGroupsDiscoveryHandler
()
{
apiserver
.
AddApisWebService
(
s
.
Serializer
,
s
.
HandlerContainer
,
s
.
apiPrefix
,
func
(
req
*
restful
.
Request
)
[]
unversioned
.
APIGroup
{
apiserver
.
AddApisWebService
(
s
.
Serializer
,
s
.
HandlerContainer
,
s
.
apiPrefix
,
func
(
req
*
restful
.
Request
)
[]
unversioned
.
APIGroup
{
...
@@ -384,7 +374,7 @@ func (s *GenericAPIServer) Run(options *options.ServerRunOptions) {
...
@@ -384,7 +374,7 @@ func (s *GenericAPIServer) Run(options *options.ServerRunOptions) {
select
{}
select
{}
}
}
// Exposes the given
group version in
API.
// Exposes the given
api group in the
API.
func
(
s
*
GenericAPIServer
)
InstallAPIGroup
(
apiGroupInfo
*
APIGroupInfo
)
error
{
func
(
s
*
GenericAPIServer
)
InstallAPIGroup
(
apiGroupInfo
*
APIGroupInfo
)
error
{
apiPrefix
:=
s
.
apiPrefix
apiPrefix
:=
s
.
apiPrefix
if
apiGroupInfo
.
IsLegacyGroup
{
if
apiGroupInfo
.
IsLegacyGroup
{
...
...
pkg/genericapiserver/genericapiserver_test.go
View file @
1063903d
...
@@ -138,7 +138,9 @@ func TestInstallAPIGroups(t *testing.T) {
...
@@ -138,7 +138,9 @@ func TestInstallAPIGroups(t *testing.T) {
NegotiatedSerializer
:
api
.
Codecs
,
NegotiatedSerializer
:
api
.
Codecs
,
},
},
}
}
s
.
InstallAPIGroups
(
apiGroupsInfo
)
for
i
:=
range
apiGroupsInfo
{
s
.
InstallAPIGroup
(
&
apiGroupsInfo
[
i
])
}
server
:=
httptest
.
NewServer
(
s
.
HandlerContainer
.
ServeMux
)
server
:=
httptest
.
NewServer
(
s
.
HandlerContainer
.
ServeMux
)
defer
server
.
Close
()
defer
server
.
Close
()
...
...
pkg/master/master.go
View file @
1063903d
...
@@ -348,8 +348,10 @@ func (m *Master) InstallAPIs(c *Config) {
...
@@ -348,8 +348,10 @@ func (m *Master) InstallAPIs(c *Config) {
apiGroupsInfo
=
append
(
apiGroupsInfo
,
apiGroupInfo
)
apiGroupsInfo
=
append
(
apiGroupsInfo
,
apiGroupInfo
)
}
}
if
err
:=
m
.
InstallAPIGroups
(
apiGroupsInfo
);
err
!=
nil
{
for
i
:=
range
apiGroupsInfo
{
glog
.
Fatalf
(
"Error in registering group versions: %v"
,
err
)
if
err
:=
m
.
InstallAPIGroup
(
&
apiGroupsInfo
[
i
]);
err
!=
nil
{
glog
.
Fatalf
(
"Error in registering group versions: %v"
,
err
)
}
}
}
}
}
...
...
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