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
1065302b
Commit
1065302b
authored
Apr 02, 2015
by
Victor Marmol
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #6327 from mikedanese/readiness-probe-busted
Fix readiness probe
parents
a94ffc86
32c7de29
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
14 deletions
+18
-14
probe.go
pkg/kubelet/probe.go
+7
-3
probe_test.go
pkg/kubelet/probe_test.go
+11
-11
No files found.
pkg/kubelet/probe.go
View file @
1065302b
...
@@ -66,10 +66,14 @@ func (kl *Kubelet) probeContainer(pod *api.Pod, status api.PodStatus, container
...
@@ -66,10 +66,14 @@ func (kl *Kubelet) probeContainer(pod *api.Pod, status api.PodStatus, container
ref
,
ok
:=
kl
.
containerRefManager
.
GetRef
(
containerID
)
ref
,
ok
:=
kl
.
containerRefManager
.
GetRef
(
containerID
)
if
!
ok
{
if
!
ok
{
glog
.
Warningf
(
"No ref for pod '%v' - '%v'"
,
containerID
,
container
.
Name
)
glog
.
Warningf
(
"No ref for pod '%v' - '%v'"
,
containerID
,
container
.
Name
)
}
else
{
return
probe
.
Success
,
err
kl
.
recorder
.
Eventf
(
ref
,
"unhealthy"
,
"Liveness Probe Failed %v - %v"
,
containerID
,
container
.
Name
)
}
}
return
ready
,
err
if
ready
!=
probe
.
Success
{
kl
.
recorder
.
Eventf
(
ref
,
"unhealthy"
,
"Readiness Probe Failed %v - %v"
,
containerID
,
container
.
Name
)
}
return
probe
.
Success
,
nil
}
}
// probeContainerLiveness probes the liveness of a container.
// probeContainerLiveness probes the liveness of a container.
...
...
pkg/kubelet/probe_test.go
View file @
1065302b
...
@@ -256,14 +256,14 @@ func TestProbeContainer(t *testing.T) {
...
@@ -256,14 +256,14 @@ func TestProbeContainer(t *testing.T) {
testContainer
:
api
.
Container
{
testContainer
:
api
.
Container
{
ReadinessProbe
:
&
api
.
Probe
{
InitialDelaySeconds
:
100
},
ReadinessProbe
:
&
api
.
Probe
{
InitialDelaySeconds
:
100
},
},
},
expectedResult
:
probe
.
Failure
,
expectedResult
:
probe
.
Success
,
expectedReadiness
:
false
,
expectedReadiness
:
false
,
},
},
{
{
testContainer
:
api
.
Container
{
testContainer
:
api
.
Container
{
ReadinessProbe
:
&
api
.
Probe
{
InitialDelaySeconds
:
-
100
},
ReadinessProbe
:
&
api
.
Probe
{
InitialDelaySeconds
:
-
100
},
},
},
expectedResult
:
probe
.
Unknown
,
expectedResult
:
probe
.
Success
,
expectedReadiness
:
false
,
expectedReadiness
:
false
,
},
},
{
{
...
@@ -275,8 +275,8 @@ func TestProbeContainer(t *testing.T) {
...
@@ -275,8 +275,8 @@ func TestProbeContainer(t *testing.T) {
},
},
},
},
},
},
expectedResult
:
probe
.
Failure
,
expectedResult
:
probe
.
Success
,
expectedReadiness
:
fals
e
,
expectedReadiness
:
tru
e
,
},
},
{
{
testContainer
:
api
.
Container
{
testContainer
:
api
.
Container
{
...
@@ -299,8 +299,8 @@ func TestProbeContainer(t *testing.T) {
...
@@ -299,8 +299,8 @@ func TestProbeContainer(t *testing.T) {
},
},
},
},
},
},
expectedResult
:
probe
.
Unknown
,
expectedResult
:
probe
.
Success
,
expectedReadiness
:
fals
e
,
expectedReadiness
:
tru
e
,
},
},
{
{
testContainer
:
api
.
Container
{
testContainer
:
api
.
Container
{
...
@@ -311,9 +311,9 @@ func TestProbeContainer(t *testing.T) {
...
@@ -311,9 +311,9 @@ func TestProbeContainer(t *testing.T) {
},
},
},
},
},
},
expectError
:
tru
e
,
expectError
:
fals
e
,
expectedResult
:
probe
.
Unknown
,
expectedResult
:
probe
.
Success
,
expectedReadiness
:
fals
e
,
expectedReadiness
:
tru
e
,
},
},
// Both LivenessProbe and ReadinessProbe.
// Both LivenessProbe and ReadinessProbe.
{
{
...
@@ -321,7 +321,7 @@ func TestProbeContainer(t *testing.T) {
...
@@ -321,7 +321,7 @@ func TestProbeContainer(t *testing.T) {
LivenessProbe
:
&
api
.
Probe
{
InitialDelaySeconds
:
100
},
LivenessProbe
:
&
api
.
Probe
{
InitialDelaySeconds
:
100
},
ReadinessProbe
:
&
api
.
Probe
{
InitialDelaySeconds
:
100
},
ReadinessProbe
:
&
api
.
Probe
{
InitialDelaySeconds
:
100
},
},
},
expectedResult
:
probe
.
Failure
,
expectedResult
:
probe
.
Success
,
expectedReadiness
:
false
,
expectedReadiness
:
false
,
},
},
{
{
...
@@ -329,7 +329,7 @@ func TestProbeContainer(t *testing.T) {
...
@@ -329,7 +329,7 @@ func TestProbeContainer(t *testing.T) {
LivenessProbe
:
&
api
.
Probe
{
InitialDelaySeconds
:
100
},
LivenessProbe
:
&
api
.
Probe
{
InitialDelaySeconds
:
100
},
ReadinessProbe
:
&
api
.
Probe
{
InitialDelaySeconds
:
-
100
},
ReadinessProbe
:
&
api
.
Probe
{
InitialDelaySeconds
:
-
100
},
},
},
expectedResult
:
probe
.
Unknown
,
expectedResult
:
probe
.
Success
,
expectedReadiness
:
false
,
expectedReadiness
:
false
,
},
},
{
{
...
...
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