Skip to content
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

Merged
merged 1 commit into from
Oct 16, 2015

Conversation

yifan-gu
Copy link
Contributor

@yifan-gu yifan-gu commented Oct 7, 2015

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

@k8s-bot
Copy link

k8s-bot commented Oct 7, 2015

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.

@yifan-gu
Copy link
Contributor Author

yifan-gu commented Oct 7, 2015

/cc @dchen1107 @yujuhong @timstclair @vishh
For some reason seems I can't @kubernetes/goog-node ? :(

@yifan-gu
Copy link
Contributor Author

yifan-gu commented Oct 7, 2015

Pending on #15051

@yifan-gu yifan-gu force-pushed the rkt_gc_systemd_service branch from 2da97a8 to 79afa7a Compare October 7, 2015 21:49
@yujuhong
Copy link
Contributor

yujuhong commented Oct 7, 2015

I think you wanted another Tim St Clair. cc'ing the right one @timstclair :)

For some reason seems I can't @kubernetes/goog-node ? :(

I noticed this too. Not sure what's criteria. Will check later.

@yujuhong
Copy link
Contributor

yujuhong commented Oct 7, 2015

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

We had the discussion recently. The restart count code is problematic and I have fixed it (too) many times :(
Basically we can either add kubelet checkpointing to persist various specs/states or push down to container runtimes to persistent the restart count (#15089: write restart count and other things to docker labels)
I had the same concern of relying on the existence of the previous container to retrieve the restart count, which may complicate the logic. However, checkpointing is a bigger project to take on, and people have concerns about it too. I think our short-term solution is docker labels (i.e., rkt service files), but perhaps this would change? @kubernetes/goog-node

@k8s-github-robot k8s-github-robot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Oct 7, 2015
@k8s-github-robot
Copy link

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)

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah. lazyness...

@yifan-gu yifan-gu force-pushed the rkt_gc_systemd_service branch from 79afa7a to 7779f6e Compare October 8, 2015 02:03
@yujuhong yujuhong assigned yujuhong and unassigned thockin Oct 8, 2015
return err
}
for _, f := range files {
if strings.HasPrefix(f.Name(), kubernetesUnitPrefix) {
Copy link
Contributor

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.

@yujuhong yujuhong assigned timstclair and unassigned yujuhong Oct 8, 2015
@yujuhong
Copy link
Contributor

yujuhong commented Oct 8, 2015

@timstclair, since you have already started reviewing this PR, I assigned it to you :)

@k8s-github-robot k8s-github-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Oct 9, 2015
@yifan-gu yifan-gu force-pushed the rkt_gc_systemd_service branch from 7779f6e to 9d2f630 Compare October 9, 2015 19:00
@yifan-gu
Copy link
Contributor Author

yifan-gu commented Oct 9, 2015

Rebased

@k8s-bot
Copy link

k8s-bot commented Oct 9, 2015

GCE e2e test build/test passed for commit 9d2f630d29f73c6579c77708be79302edaaeb01c.

@k8s-github-robot k8s-github-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Oct 9, 2015
@yifan-gu
Copy link
Contributor Author

ping?

}
for _, f := range files {
if strings.HasPrefix(f.Name(), kubernetesUnitPrefix) {
if _, ok := runningUnits[f.Name()]; !ok {

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()) { ...

@timstclair
Copy link

LGTM. Sorry I lost track of this.

@yifan-gu yifan-gu force-pushed the rkt_gc_systemd_service branch from 9d2f630 to 9d01933 Compare October 16, 2015 01:21
@yifan-gu
Copy link
Contributor Author

LGTM. Sorry I lost track of this.

No worries, thanks for the review, comments addressed :)

@timstclair timstclair added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Oct 16, 2015
@k8s-bot
Copy link

k8s-bot commented Oct 16, 2015

GCE e2e test build/test passed for commit 9d01933.

@k8s-github-robot
Copy link

@k8s-bot test this [submit-queue is verifying that this PR is safe to merge]

@k8s-bot
Copy link

k8s-bot commented Oct 16, 2015

GCE e2e test build/test passed for commit 9d01933.

@k8s-github-robot
Copy link

Automatic merge from submit-queue

k8s-github-robot pushed a commit that referenced this pull request Oct 16, 2015
@k8s-github-robot k8s-github-robot merged commit dc685df into kubernetes:master Oct 16, 2015
@yifan-gu yifan-gu deleted the rkt_gc_systemd_service branch October 16, 2015 18:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lgtm "Looks good to me", indicates that a PR is ready to be merged. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants