Skip to content
This repository has been archived by the owner on Jan 4, 2022. It is now read-only.

[WIP] cnispawn: run container in detached transient unit #257

Closed
wants to merge 1 commit into from

Conversation

schu
Copy link
Contributor

@schu schu commented Jan 19, 2018

With that, the container lifetime is not tied to the lifetime of the
slice in which kube-spawn is running.

This commit doesn't add code to shutdown and remove the network
namespace when the cluster is stopped. This is yet to be done.

With that, the container lifetime is not tied to the lifetime of the
slice in which kube-spawn is running.

This commit doesn't add code to shutdown and remove the network
namespace when the cluster is stopped. This is yet to be done.
@schu schu requested a review from alban January 19, 2018 09:18
@schu
Copy link
Contributor Author

schu commented Jan 19, 2018

This commit doesn't add code to shutdown and remove the network
namespace when the cluster is stopped. This is yet to be done.

I'm not sure yet how to do that best and maybe want to combine it with refactoring the code. Input welcome.

@schu
Copy link
Contributor Author

schu commented Jan 19, 2018

xref #212

@alban
Copy link
Member

alban commented Jan 19, 2018

kube-spawn should check if the version of systemd-nspawn on the host is v236 before using --network-namespace-path=.

rkt has a similar version test.

Unfortunately, we need fallback code because v236 is not in every distro.

env = append(env, "SYSTEMD_NSPAWN_USE_CGNS=0")

_, err = syscall.ForkExec(systemdNspawnPath, args, &syscall.ProcAttr{
_, err = syscall.ForkExec(systemdRunPath, args, &syscall.ProcAttr{
Copy link
Member

Choose a reason for hiding this comment

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

We could use systemd-run --service-type=notify together with systemd-nspawn --notify-ready=yes right now. We could then debug more easily with systemctl status run-xxxx.service.

Possibly use systemd-run --unit= using a user-friendly generated name too. And --slice=machine.slice (I had a look at /usr/lib/systemd/system/systemd-nspawn@.service).

And lastly, but it might require more refactoring so maybe in a future step: instead of syscall.ForkExec(), use os.exec so you can catch the stdout/stderr and exit status, and print those in case of errors. We would need to start the 3 nodes in parallel (in case of a 3-node cluster) and I don't know if the current code does this in parallel (hence the need for refactoring).

@dongsupark
Copy link
Member

I've just realized that this PR would conflict with my PR #328. I totally forgot.
I think we should make a new issue to address points that were mentioned here. Then after #328 was merged, we can revisit those issues.
Is that ok?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants