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
cb6fe9e7
Commit
cb6fe9e7
authored
May 05, 2016
by
Random-Liu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Delete pod with uid as precondition.
parent
fe4d83dc
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
1 deletion
+5
-1
mirror_client.go
pkg/kubelet/pod/mirror_client.go
+1
-0
manager.go
pkg/kubelet/status/manager.go
+4
-1
No files found.
pkg/kubelet/pod/mirror_client.go
View file @
cb6fe9e7
...
@@ -76,6 +76,7 @@ func (mc *basicMirrorClient) DeleteMirrorPod(podFullName string) error {
...
@@ -76,6 +76,7 @@ func (mc *basicMirrorClient) DeleteMirrorPod(podFullName string) error {
return
err
return
err
}
}
glog
.
V
(
4
)
.
Infof
(
"Deleting a mirror pod %q"
,
podFullName
)
glog
.
V
(
4
)
.
Infof
(
"Deleting a mirror pod %q"
,
podFullName
)
// TODO(random-liu): Delete the mirror pod with uid precondition in mirror pod manager
if
err
:=
mc
.
apiserverClient
.
Core
()
.
Pods
(
namespace
)
.
Delete
(
name
,
api
.
NewDeleteOptions
(
0
));
err
!=
nil
&&
!
errors
.
IsNotFound
(
err
)
{
if
err
:=
mc
.
apiserverClient
.
Core
()
.
Pods
(
namespace
)
.
Delete
(
name
,
api
.
NewDeleteOptions
(
0
));
err
!=
nil
&&
!
errors
.
IsNotFound
(
err
)
{
glog
.
Errorf
(
"Failed deleting a mirror pod %q: %v"
,
podFullName
,
err
)
glog
.
Errorf
(
"Failed deleting a mirror pod %q: %v"
,
podFullName
,
err
)
}
}
...
...
pkg/kubelet/status/manager.go
View file @
cb6fe9e7
...
@@ -396,7 +396,10 @@ func (m *manager) syncPod(uid types.UID, status versionedPodStatus) {
...
@@ -396,7 +396,10 @@ func (m *manager) syncPod(uid types.UID, status versionedPodStatus) {
glog
.
V
(
3
)
.
Infof
(
"Pod %q is terminated, but some containers are still running"
,
format
.
Pod
(
pod
))
glog
.
V
(
3
)
.
Infof
(
"Pod %q is terminated, but some containers are still running"
,
format
.
Pod
(
pod
))
return
return
}
}
if
err
:=
m
.
kubeClient
.
Core
()
.
Pods
(
pod
.
Namespace
)
.
Delete
(
pod
.
Name
,
api
.
NewDeleteOptions
(
0
));
err
==
nil
{
deleteOptions
:=
api
.
NewDeleteOptions
(
0
)
// Use the pod UID as the precondition for deletion to prevent deleting a newly created pod with the same name and namespace.
deleteOptions
.
Preconditions
=
api
.
NewUIDPreconditions
(
string
(
pod
.
UID
))
if
err
:=
m
.
kubeClient
.
Core
()
.
Pods
(
pod
.
Namespace
)
.
Delete
(
pod
.
Name
,
deleteOptions
);
err
==
nil
{
glog
.
V
(
3
)
.
Infof
(
"Pod %q fully terminated and removed from etcd"
,
format
.
Pod
(
pod
))
glog
.
V
(
3
)
.
Infof
(
"Pod %q fully terminated and removed from etcd"
,
format
.
Pod
(
pod
))
m
.
deletePodStatus
(
uid
)
m
.
deletePodStatus
(
uid
)
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