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

vmm: Unshare IPC and UTS namespaces for container process #107

Merged
merged 1 commit into from
Jan 15, 2024

Conversation

Burning1020
Copy link
Member

@Burning1020 Burning1020 commented Jan 12, 2024

Container process needs a POD level IPC and UTS namespace unshared with kuasar-task by default as pause container has been removed.

In this commit, kuasar-task will unshare a new ns and bind mount it to /run/sandbox-ns, in which the container could join. The hostname in the sandbox pod config will be set into uts ns by runC when creating container.

TODO: Pod level PID namespace implementation.

@Burning1020 Burning1020 requested a review from a team as a code owner January 12, 2024 02:40
@Burning1020 Burning1020 force-pushed the sandbox-ns branch 3 times, most recently from e385ece to 58a1614 Compare January 12, 2024 03:15
}

// Update container hostname to sandbox hostname
spec.hostname = hostname;
Copy link
Contributor

Choose a reason for hiding this comment

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

will these two values be different?

Copy link
Member Author

Choose a reason for hiding this comment

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

Containerd would not set hostname for container, it only set it to pod.

}

thread::spawn(move || {
unshare(clone_type).expect("failed to do unshare");
Copy link
Contributor

Choose a reason for hiding this comment

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

will this affect the whole process?

Copy link
Member Author

Choose a reason for hiding this comment

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

No

@@ -71,6 +77,20 @@ where
}
// Update sandbox files mounts for container
container_mounts(&shared_path, spec);

// Update ipc and uts namespace for container
if let Some(linux) = spec.linux.as_mut() {
Copy link
Contributor

Choose a reason for hiding this comment

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

there is a namespace handler, which is doing similar things

Copy link
Member Author

Choose a reason for hiding this comment

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

OK

@Burning1020 Burning1020 force-pushed the sandbox-ns branch 3 times, most recently from 4696b10 to dafab32 Compare January 12, 2024 09:15
Container process needs a POD level IPC and UTS namespace unshared with
kuasar-task by default as pause container has been removed.

In this commit, kuasar-task will unshare a new ns and bind mount it to
`/run/sandbox-ns`, in which the container could join. The hostname in the
sandbox pod config will be set into uts ns by runC when creating container.

Signed-off-by: Zhang Tianyang <burning9699@gmail.com>
@abel-von abel-von merged commit af46231 into kuasar-io:main Jan 15, 2024
15 checks passed
@Burning1020 Burning1020 deleted the sandbox-ns branch January 19, 2024 09:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants