Skip to content
This repository has been archived by the owner on Feb 24, 2020. It is now read-only.

rkt: add rkt stop #1959

Closed
wants to merge 9 commits into from
Closed

rkt: add rkt stop #1959

wants to merge 9 commits into from

Conversation

iaguis
Copy link
Member

@iaguis iaguis commented Jan 12, 2016

This PR introduces a new stop entrypoint that deals with shutting down the pod.

  • For the nspawn and fly, It sends SIGTERM to the top-level stage1 process.
  • For the lkvm flavor, it execs lkvm stop.

Fixes partially #1417
Closes #1496


  • tests

The stop entrypoint initiates an orderly shutdown of stage1.

In the bundled rkt stage 1, the entrypoint is a statically-linked C program that sends a SIGTERM to the systemd-nspawn process, which will deal with shutting down the container.

Copy link
Member

Choose a reason for hiding this comment

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

Can you say what should stage0 do if the entrypoint is not there in the stage1 manifest? I guess it should just print the error "not implemented" or something.

See #1897.

The manifest below needs to be updated.

Copy link
Member Author

Choose a reason for hiding this comment

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

Can you say what should stage0 do if the entrypoint is not there in the stage1 manifest? I guess it should just print the error "not implemented" or something.

Does it belong here? This is the stage1 implementors guide...

The manifest below needs to be updated.

done

Copy link
Collaborator

Choose a reason for hiding this comment

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

I guess we could rather say something like "The optional stop entrypoint initiates blah blah blah".

@iaguis
Copy link
Member Author

iaguis commented Jan 12, 2016

This needs some more work.

@@ -95,6 +95,12 @@ For example, it removes the network namespace of a pod.
* `--debug` to activate debugging
* UUID of the pod

### `rkt stop` => "coreos.com/rkt/stage1/stop"
Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Member Author

Choose a reason for hiding this comment

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

done

@iaguis iaguis force-pushed the iaguis/rkt-stop branch 2 times, most recently from 74a4de5 to 04429f1 Compare January 12, 2016 15:02
@iaguis iaguis changed the title Iaguis/rkt stop rkt: add rkt stop Jan 12, 2016
const lkvmBinPath string = "stage1/rootfs/lkvm"

func stop() int {
pwd, err := os.Getwd()
Copy link
Contributor

Choose a reason for hiding this comment

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

Drive by comment: this seems a bit fragile. Maybe we should add a uuid arg to the entrypoint..?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yep, done.

@iaguis
Copy link
Member Author

iaguis commented Jan 13, 2016

Updated and added a --force flag suggested by @alban

@@ -0,0 +1,3 @@
# rkt stop

Given a list of pod UUIDs, rkt stop will shut them down cleanly.
Copy link
Member

Choose a reason for hiding this comment

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

You can add copy/paste of the command output, to see how it looks like.

With and without --force.

Copy link
Member

Choose a reason for hiding this comment

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

It should be explained what "shut them down cleanly" means, and compare with --force.

The app in the pod receives a TERM signal and after a timeout a KILL signal.

Is the post-stop event handler executed?

@alban
Copy link
Member

alban commented Jan 14, 2016

Please update CHANGELOG.md too.

@iaguis iaguis removed this from the v1.0.0 milestone Jan 26, 2016
@jonboulle jonboulle modified the milestones: v1.0.0, v1+ Jan 27, 2016
@iaguis iaguis modified the milestones: v1.1.0, v1.0.0 Jan 28, 2016
@iaguis iaguis modified the milestones: v1.2.0, v1.1.0 Feb 24, 2016
@iaguis iaguis modified the milestones: v1.4.0, v1.2.0 Mar 18, 2016
@iaguis iaguis modified the milestones: v1.6.0, v1.4.0 Apr 14, 2016
@iaguis
Copy link
Member Author

iaguis commented Apr 14, 2016

@jellonek do you think you'll have time to look into this?

@jellonek
Copy link
Contributor

I can look on this tomorrow. How I can contribute to this? Should I fork kinvolk:iaguis/rkt-stop, propose some commit in place of this one for kvm, and point You there to my branch? This should work...

@iaguis
Copy link
Member Author

iaguis commented Apr 14, 2016

I can look on this tomorrow. How I can contribute to this? Should I fork kinvolk:iaguis/rkt-stop, propose some commit in place of this one for kvm, and point You there to my branch? This should work...

That sounds good, let me rebase this branch, it's kinda old...

iaguis added 8 commits April 14, 2016 16:52
The stage1 implementation sends SIGTERM to systemd-nspawn, which causes
an orderly shutdown of stage1.

Update the stage1 API version.
The stage1 implementation calls "lkvm stop" which will shut down the VM
instance.

Update the stage1 API version.
The stage1 implementation sends SIGTERM to the process started by rkt
fly.

Update the stage1 API version.
Makes getting the lkvm VM name less ugly.

Add --force to forcibly stopping a pod.
@iaguis
Copy link
Member Author

iaguis commented Apr 14, 2016

Rebased.

@jonboulle
Copy link
Contributor

closing in favour of #2438

@alban alban closed this May 12, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants