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
aa740646
Unverified
Commit
aa740646
authored
Apr 09, 2019
by
Kubernetes Prow Robot
Committed by
GitHub
Apr 09, 2019
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #75217 from deads2k/agg-parallel
for aggregated apiserver availability, try multiple endpoints in parallel
parents
a2c200a5
0f7185e7
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
44 additions
and
21 deletions
+44
-21
available_controller.go
...aggregator/pkg/controllers/status/available_controller.go
+44
-21
No files found.
staging/src/k8s.io/kube-aggregator/pkg/controllers/status/available_controller.go
View file @
aa740646
...
...
@@ -242,33 +242,56 @@ func (c *AvailableConditionController) sync(key string) error {
}
// actually try to hit the discovery endpoint when it isn't local and when we're routing as a service.
if
apiService
.
Spec
.
Service
!=
nil
&&
c
.
serviceResolver
!=
nil
{
discoveryURL
,
err
:=
c
.
serviceResolver
.
ResolveEndpoint
(
apiService
.
Spec
.
Service
.
Namespace
,
apiService
.
Spec
.
Service
.
Name
,
apiService
.
Spec
.
Service
.
Port
)
if
err
!=
nil
{
return
err
}
attempts
:=
5
results
:=
make
(
chan
error
,
attempts
)
for
i
:=
0
;
i
<
attempts
;
i
++
{
go
func
()
{
discoveryURL
,
err
:=
c
.
serviceResolver
.
ResolveEndpoint
(
apiService
.
Spec
.
Service
.
Namespace
,
apiService
.
Spec
.
Service
.
Name
,
apiService
.
Spec
.
Service
.
Port
)
if
err
!=
nil
{
results
<-
err
return
}
errCh
:=
make
(
chan
error
)
go
func
()
{
resp
,
err
:=
c
.
discoveryClient
.
Get
(
discoveryURL
.
String
())
if
resp
!=
nil
{
resp
.
Body
.
Close
()
}
errCh
<-
err
}()
errCh
:=
make
(
chan
error
)
go
func
()
{
resp
,
err
:=
c
.
discoveryClient
.
Get
(
discoveryURL
.
String
())
if
resp
!=
nil
{
resp
.
Body
.
Close
()
}
errCh
<-
err
}()
select
{
case
err
=
<-
errCh
:
if
err
!=
nil
{
results
<-
fmt
.
Errorf
(
"no response from %v: %v"
,
discoveryURL
,
err
)
return
}
// we had trouble with slow dial and DNS responses causing us to wait too long.
// we added this as insurance
case
<-
time
.
After
(
6
*
time
.
Second
)
:
results
<-
fmt
.
Errorf
(
"timed out waiting for %v"
,
discoveryURL
)
return
}
select
{
case
err
=
<-
errCh
:
results
<-
nil
}()
}
// we had trouble with slow dial and DNS responses causing us to wait too long.
// we added this as insurance
case
<-
time
.
After
(
6
*
time
.
Second
)
:
err
=
fmt
.
Errorf
(
"timed out waiting for %v"
,
discoveryURL
)
var
lastError
error
for
i
:=
0
;
i
<
attempts
;
i
++
{
lastError
=
<-
results
// if we had at least one success, we are successful overall and we can return now
if
lastError
==
nil
{
break
}
}
if
er
r
!=
nil
{
if
lastErro
r
!=
nil
{
availableCondition
.
Status
=
apiregistration
.
ConditionFalse
availableCondition
.
Reason
=
"FailedDiscoveryCheck"
availableCondition
.
Message
=
fmt
.
Sprintf
(
"no response from %v: %v"
,
discoveryURL
,
err
)
availableCondition
.
Message
=
lastError
.
Error
(
)
apiregistration
.
SetAPIServiceCondition
(
apiService
,
availableCondition
)
_
,
updateErr
:=
updateAPIServiceStatus
(
c
.
apiServiceClient
,
originalAPIService
,
apiService
)
if
updateErr
!=
nil
{
...
...
@@ -276,7 +299,7 @@ func (c *AvailableConditionController) sync(key string) error {
}
// force a requeue to make it very obvious that this will be retried at some point in the future
// along with other requeues done via service change, endpoint change, and resync
return
er
r
return
lastErro
r
}
}
...
...
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