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
9b5696b7
Commit
9b5696b7
authored
Jul 18, 2016
by
k8s-merge-robot
Committed by
GitHub
Jul 18, 2016
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #26705 from nebril/issue-26704
Automatic merge from submit-queue Make discovery summarizer call servers in parallel fixes #26704
parents
60324942
ee6f50ec
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
28 additions
and
9 deletions
+28
-9
discoverysummarizer.go
...etes-discovery/discoverysummarizer/discoverysummarizer.go
+28
-9
No files found.
cmd/kubernetes-discovery/discoverysummarizer/discoverysummarizer.go
View file @
9b5696b7
...
@@ -102,20 +102,39 @@ func (ds *discoverySummarizerServer) indexHandler(w http.ResponseWriter, r *http
...
@@ -102,20 +102,39 @@ func (ds *discoverySummarizerServer) indexHandler(w http.ResponseWriter, r *http
func
(
ds
*
discoverySummarizerServer
)
summarizeGroupVersionsHandler
(
path
string
)
func
(
http
.
ResponseWriter
,
*
http
.
Request
)
{
func
(
ds
*
discoverySummarizerServer
)
summarizeGroupVersionsHandler
(
path
string
)
func
(
http
.
ResponseWriter
,
*
http
.
Request
)
{
return
func
(
w
http
.
ResponseWriter
,
r
*
http
.
Request
)
{
return
func
(
w
http
.
ResponseWriter
,
r
*
http
.
Request
)
{
var
apiGroupList
*
unversioned
.
APIGroupList
var
apiGroupList
*
unversioned
.
APIGroupList
// TODO: We can cache and parallelize the calls to all servers.
// TODO: We can cache calls to all servers.
groups
:=
make
(
chan
*
unversioned
.
APIGroupList
)
errorChannel
:=
make
(
chan
error
)
for
_
,
serverAddress
:=
range
ds
.
groupVersionPaths
[
path
]
{
for
_
,
serverAddress
:=
range
ds
.
groupVersionPaths
[
path
]
{
groupList
,
err
:=
ds
.
getAPIGroupList
(
serverAddress
+
path
)
addr
:=
serverAddress
if
err
!=
nil
{
go
func
(
groups
chan
*
unversioned
.
APIGroupList
,
error_channel
chan
error
)
{
groupList
,
err
:=
ds
.
getAPIGroupList
(
addr
+
path
)
if
err
!=
nil
{
errorChannel
<-
err
return
}
groups
<-
groupList
return
}(
groups
,
errorChannel
)
}
var
groupList
*
unversioned
.
APIGroupList
var
err
error
for
range
ds
.
groupVersionPaths
[
path
]
{
select
{
case
groupList
=
<-
groups
:
if
apiGroupList
==
nil
{
apiGroupList
=
&
unversioned
.
APIGroupList
{}
*
apiGroupList
=
*
groupList
}
else
{
apiGroupList
.
Groups
=
append
(
apiGroupList
.
Groups
,
groupList
.
Groups
...
)
}
case
err
=
<-
errorChannel
:
ds
.
writeErr
(
http
.
StatusBadGateway
,
err
,
w
)
ds
.
writeErr
(
http
.
StatusBadGateway
,
err
,
w
)
return
return
}
}
if
apiGroupList
==
nil
{
apiGroupList
=
&
unversioned
.
APIGroupList
{}
*
apiGroupList
=
*
groupList
}
else
{
apiGroupList
.
Groups
=
append
(
apiGroupList
.
Groups
,
groupList
.
Groups
...
)
}
}
}
ds
.
writeRawJSON
(
http
.
StatusOK
,
*
apiGroupList
,
w
)
ds
.
writeRawJSON
(
http
.
StatusOK
,
*
apiGroupList
,
w
)
return
return
}
}
...
...
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