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
e94a9f93
Unverified
Commit
e94a9f93
authored
Nov 16, 2018
by
k8s-ci-robot
Committed by
GitHub
Nov 16, 2018
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #71085 from bsalamat/leader-election-fix
Report kube-scheduler unhealthy if leader election is wedged
parents
92fe9d94
34b4a5bb
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
4 deletions
+12
-4
options.go
cmd/kube-scheduler/app/options/options.go
+2
-0
server.go
cmd/kube-scheduler/app/server.go
+10
-4
No files found.
cmd/kube-scheduler/app/options/options.go
View file @
e94a9f93
...
@@ -286,6 +286,8 @@ func makeLeaderElectionConfig(config kubeschedulerconfig.KubeSchedulerLeaderElec
...
@@ -286,6 +286,8 @@ func makeLeaderElectionConfig(config kubeschedulerconfig.KubeSchedulerLeaderElec
LeaseDuration
:
config
.
LeaseDuration
.
Duration
,
LeaseDuration
:
config
.
LeaseDuration
.
Duration
,
RenewDeadline
:
config
.
RenewDeadline
.
Duration
,
RenewDeadline
:
config
.
RenewDeadline
.
Duration
,
RetryPeriod
:
config
.
RetryPeriod
.
Duration
,
RetryPeriod
:
config
.
RetryPeriod
.
Duration
,
WatchDog
:
leaderelection
.
NewLeaderHealthzAdaptor
(
time
.
Second
*
20
),
Name
:
"kube-scheduler"
,
},
nil
},
nil
}
}
...
...
cmd/kube-scheduler/app/server.go
View file @
e94a9f93
...
@@ -200,10 +200,16 @@ func Run(cc schedulerserverconfig.CompletedConfig, stopCh <-chan struct{}) error
...
@@ -200,10 +200,16 @@ func Run(cc schedulerserverconfig.CompletedConfig, stopCh <-chan struct{}) error
cc
.
Broadcaster
.
StartRecordingToSink
(
&
v1core
.
EventSinkImpl
{
Interface
:
cc
.
EventClient
.
Events
(
""
)})
cc
.
Broadcaster
.
StartRecordingToSink
(
&
v1core
.
EventSinkImpl
{
Interface
:
cc
.
EventClient
.
Events
(
""
)})
}
}
// Setup healthz checks.
var
checks
[]
healthz
.
HealthzChecker
if
cc
.
ComponentConfig
.
LeaderElection
.
LeaderElect
{
checks
=
append
(
checks
,
cc
.
LeaderElection
.
WatchDog
)
}
// Start up the healthz server.
// Start up the healthz server.
if
cc
.
InsecureServing
!=
nil
{
if
cc
.
InsecureServing
!=
nil
{
separateMetrics
:=
cc
.
InsecureMetricsServing
!=
nil
separateMetrics
:=
cc
.
InsecureMetricsServing
!=
nil
handler
:=
buildHandlerChain
(
newHealthzHandler
(
&
cc
.
ComponentConfig
,
separateMetrics
),
nil
,
nil
)
handler
:=
buildHandlerChain
(
newHealthzHandler
(
&
cc
.
ComponentConfig
,
separateMetrics
,
checks
...
),
nil
,
nil
)
if
err
:=
cc
.
InsecureServing
.
Serve
(
handler
,
0
,
stopCh
);
err
!=
nil
{
if
err
:=
cc
.
InsecureServing
.
Serve
(
handler
,
0
,
stopCh
);
err
!=
nil
{
return
fmt
.
Errorf
(
"failed to start healthz server: %v"
,
err
)
return
fmt
.
Errorf
(
"failed to start healthz server: %v"
,
err
)
}
}
...
@@ -215,7 +221,7 @@ func Run(cc schedulerserverconfig.CompletedConfig, stopCh <-chan struct{}) error
...
@@ -215,7 +221,7 @@ func Run(cc schedulerserverconfig.CompletedConfig, stopCh <-chan struct{}) error
}
}
}
}
if
cc
.
SecureServing
!=
nil
{
if
cc
.
SecureServing
!=
nil
{
handler
:=
buildHandlerChain
(
newHealthzHandler
(
&
cc
.
ComponentConfig
,
false
),
cc
.
Authentication
.
Authenticator
,
cc
.
Authorization
.
Authorizer
)
handler
:=
buildHandlerChain
(
newHealthzHandler
(
&
cc
.
ComponentConfig
,
false
,
checks
...
),
cc
.
Authentication
.
Authenticator
,
cc
.
Authorization
.
Authorizer
)
if
err
:=
cc
.
SecureServing
.
Serve
(
handler
,
0
,
stopCh
);
err
!=
nil
{
if
err
:=
cc
.
SecureServing
.
Serve
(
handler
,
0
,
stopCh
);
err
!=
nil
{
// fail early for secure handlers, removing the old error loop from above
// fail early for secure handlers, removing the old error loop from above
return
fmt
.
Errorf
(
"failed to start healthz server: %v"
,
err
)
return
fmt
.
Errorf
(
"failed to start healthz server: %v"
,
err
)
...
@@ -313,9 +319,9 @@ func newMetricsHandler(config *kubeschedulerconfig.KubeSchedulerConfiguration) h
...
@@ -313,9 +319,9 @@ func newMetricsHandler(config *kubeschedulerconfig.KubeSchedulerConfiguration) h
// newHealthzServer creates a healthz server from the config, and will also
// newHealthzServer creates a healthz server from the config, and will also
// embed the metrics handler if the healthz and metrics address configurations
// embed the metrics handler if the healthz and metrics address configurations
// are the same.
// are the same.
func
newHealthzHandler
(
config
*
kubeschedulerconfig
.
KubeSchedulerConfiguration
,
separateMetrics
bool
)
http
.
Handler
{
func
newHealthzHandler
(
config
*
kubeschedulerconfig
.
KubeSchedulerConfiguration
,
separateMetrics
bool
,
checks
...
healthz
.
HealthzChecker
)
http
.
Handler
{
pathRecorderMux
:=
mux
.
NewPathRecorderMux
(
"kube-scheduler"
)
pathRecorderMux
:=
mux
.
NewPathRecorderMux
(
"kube-scheduler"
)
healthz
.
InstallHandler
(
pathRecorderMux
)
healthz
.
InstallHandler
(
pathRecorderMux
,
checks
...
)
if
!
separateMetrics
{
if
!
separateMetrics
{
installMetricHandler
(
pathRecorderMux
)
installMetricHandler
(
pathRecorderMux
)
}
}
...
...
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