-
Notifications
You must be signed in to change notification settings - Fork 40.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
kubelet/rkt: garbage collect systemd service files in GarbageCollect(). #15260
kubelet/rkt: garbage collect systemd service files in GarbageCollect(). #15260
Conversation
Can one of the admins verify that this patch is reasonable to test? (reply "ok to test", or if you trust the user, reply "add to whitelist") If this message is too spammy, please complain to ixdy. |
/cc @dchen1107 @yujuhong @timstclair @vishh |
Pending on #15051 |
2da97a8
to
79afa7a
Compare
I think you wanted another Tim St Clair. cc'ing the right one @timstclair :)
I noticed this too. Not sure what's criteria. Will check later. |
We had the discussion recently. The restart count code is problematic and I have fixed it (too) many times :( |
Labelling this PR as size/M |
// Touch the systemd service file to update the mod time so it will | ||
// not be garbage collected too soon. | ||
if err := os.Chtimes(serviceFilePath(serviceName), time.Now(), time.Now()); err != nil { | ||
glog.Errorf("rkt: Failed to change the modification time of the service file %v: %v", serviceName, err) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(nit) %q
for string strings (I just learned this)
Same below.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah. lazyness...
79afa7a
to
7779f6e
Compare
return err | ||
} | ||
for _, f := range files { | ||
if strings.HasPrefix(f.Name(), kubernetesUnitPrefix) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: reduce the nested if
levels by using continue
here? This is more of a personal preference, so it's up to you.
@timstclair, since you have already started reviewing this PR, I assigned it to you :) |
7779f6e
to
9d2f630
Compare
Rebased |
GCE e2e test build/test passed for commit 9d2f630d29f73c6579c77708be79302edaaeb01c. |
ping? |
} | ||
for _, f := range files { | ||
if strings.HasPrefix(f.Name(), kubernetesUnitPrefix) { | ||
if _, ok := runningUnits[f.Name()]; !ok { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(nit) if runningUnits.Has(f.Name()) { ...
LGTM. Sorry I lost track of this. |
9d2f630
to
9d01933
Compare
No worries, thanks for the review, comments addressed :) |
GCE e2e test build/test passed for commit 9d01933. |
@k8s-bot test this [submit-queue is verifying that this PR is safe to merge] |
GCE e2e test build/test passed for commit 9d01933. |
Automatic merge from submit-queue |
Auto commit by PR queue bot
Not removing the service file in KillPod() because when starting the pod, we need a way to tell if the restart count should be increased. And currently the restart count is stored in the systemd service file.
I'm open to other solution. Maybe we should create a file to store the info under
/var/lib/kubelet/pod/$UID/container/
, and this should be helpful for docker runtime as well. It should simplify the computation of the restart count, such as here