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
ddfa04ea
Commit
ddfa04ea
authored
Jul 01, 2017
by
Klaus Ma
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added case on 'terminated-but-not-yet-deleted' for Admit.
parent
956acc2b
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
2 deletions
+12
-2
kubelet_pods.go
pkg/kubelet/kubelet_pods.go
+1
-2
kubelet_test.go
pkg/kubelet/kubelet_test.go
+11
-0
No files found.
pkg/kubelet/kubelet_pods.go
View file @
ddfa04ea
...
@@ -729,9 +729,8 @@ func (kl *Kubelet) getPullSecretsForPod(pod *v1.Pod) []v1.Secret {
...
@@ -729,9 +729,8 @@ func (kl *Kubelet) getPullSecretsForPod(pod *v1.Pod) []v1.Secret {
return
pullSecrets
return
pullSecrets
}
}
//
R
eturns true if pod is in the terminated state ("Failed" or "Succeeded").
//
podIsTerminated r
eturns true if pod is in the terminated state ("Failed" or "Succeeded").
func
(
kl
*
Kubelet
)
podIsTerminated
(
pod
*
v1
.
Pod
)
bool
{
func
(
kl
*
Kubelet
)
podIsTerminated
(
pod
*
v1
.
Pod
)
bool
{
var
status
v1
.
PodStatus
// Check the cached pod status which was set after the last sync.
// Check the cached pod status which was set after the last sync.
status
,
ok
:=
kl
.
statusManager
.
GetPodStatus
(
pod
.
UID
)
status
,
ok
:=
kl
.
statusManager
.
GetPodStatus
(
pod
.
UID
)
if
!
ok
{
if
!
ok
{
...
...
pkg/kubelet/kubelet_test.go
View file @
ddfa04ea
...
@@ -1249,10 +1249,21 @@ func TestFilterOutTerminatedPods(t *testing.T) {
...
@@ -1249,10 +1249,21 @@ func TestFilterOutTerminatedPods(t *testing.T) {
defer
testKubelet
.
Cleanup
()
defer
testKubelet
.
Cleanup
()
kubelet
:=
testKubelet
.
kubelet
kubelet
:=
testKubelet
.
kubelet
pods
:=
newTestPods
(
5
)
pods
:=
newTestPods
(
5
)
now
:=
metav1
.
NewTime
(
time
.
Now
())
pods
[
0
]
.
Status
.
Phase
=
v1
.
PodFailed
pods
[
0
]
.
Status
.
Phase
=
v1
.
PodFailed
pods
[
1
]
.
Status
.
Phase
=
v1
.
PodSucceeded
pods
[
1
]
.
Status
.
Phase
=
v1
.
PodSucceeded
// The pod is terminating, should not filter out.
pods
[
2
]
.
Status
.
Phase
=
v1
.
PodRunning
pods
[
2
]
.
Status
.
Phase
=
v1
.
PodRunning
pods
[
2
]
.
DeletionTimestamp
=
&
now
pods
[
2
]
.
Status
.
ContainerStatuses
=
[]
v1
.
ContainerStatus
{
{
State
:
v1
.
ContainerState
{
Running
:
&
v1
.
ContainerStateRunning
{
StartedAt
:
now
,
},
}},
}
pods
[
3
]
.
Status
.
Phase
=
v1
.
PodPending
pods
[
3
]
.
Status
.
Phase
=
v1
.
PodPending
pods
[
4
]
.
Status
.
Phase
=
v1
.
PodRunning
expected
:=
[]
*
v1
.
Pod
{
pods
[
2
],
pods
[
3
],
pods
[
4
]}
expected
:=
[]
*
v1
.
Pod
{
pods
[
2
],
pods
[
3
],
pods
[
4
]}
kubelet
.
podManager
.
SetPods
(
pods
)
kubelet
.
podManager
.
SetPods
(
pods
)
...
...
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