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.makeMounts() is mixing the usage of the kubecontainer.Mount.Name #33526

Closed
yifan-gu opened this issue Sep 27, 2016 · 7 comments
Closed
Labels
sig/node Categorizes an issue or PR as relevant to SIG Node.

Comments

@yifan-gu
Copy link
Contributor

yifan-gu commented Sep 27, 2016

kubelet.makeMounts is a help function that runs during each container creation.
It takes a pod spec, and a container spec to generate kubecontainer.Mount (name, container-path, host-path, readonly, selinux_relabel) by matching the container spec's volume mount to the pod spec's volumes.

But meanwhile, it's also generating arbitrary kubecontainer.Mount that has no corresponding volumes in the pod spec, such as mounting host machine's /etc/hosts.

Thus when runtime tries to look for the volumes by the volume name in the interface, it cannot find any volumes.

Another issue is if container spec defines a subPath in the volume mount, then we will end up with two kubecontainer.Mount that have same names, same container paths, but different host paths. This is not supported by rkt as one volume name should map to one host path.

So the action required here is:
Option 1: Generate correct volumes for these arbitrary mounts and subpath mounts, and pass them through PodSandboxConfig during the creation of the sandbox. Later it passes the runtime the mounts object (volume_name, container_path), and runtime is able to do the correct mounts by finding the volumes through names.

This implies the mounts for each apps within the sand box must have a pre-established volumes.

Option 2: Remove the mount name, or at least change that to not be the volume name. Require runtime to support mounting any container-path:host-path pairs, basically requires runtime to know nothing about volumes

cc @yujuhong @feiskyer @euank @alban @lucab @jonboulle

@yifan-gu yifan-gu added the sig/node Categorizes an issue or PR as relevant to SIG Node. label Sep 27, 2016
@yifan-gu
Copy link
Contributor Author

cc @kubernetes/sig-node @kubernetes/sig-rktnetes

@jonboulle
Copy link
Contributor

Volumes don't exist at all in the CRI API at the moment, which suggests that 2 is already the implicit path?

@yifan-gu
Copy link
Contributor Author

@jonboulle Yes, the current docker implementation is the path 2. And according to @squeed rkt/rkt#3239 (comment) , it will will be doable by rkt soon. So I guess the action we need to do is to clean up the kubecontainer.Mount.Name, either remove it, or make it unique for each container-path:host-path pair.

@pmorie
Copy link
Member

pmorie commented Oct 3, 2016

For the record, I would also like makeMounts to make the mountpoints for container termination logs.

@yifan-gu
Copy link
Contributor Author

yifan-gu commented Oct 3, 2016

@pmorie Exactly!

@yujuhong
Copy link
Contributor

yujuhong commented Oct 3, 2016

For the record, I would also like makeMounts to make the mountpoints for container termination logs.

I have no objection to that.

@yifan-gu
Copy link
Contributor Author

yifan-gu commented Oct 3, 2016

@pmorie @yujuhong Actually the makeMounts() in kuberuntime_container.go already makes the mount point for the termination log, so the mount points in CRI has the termination message log mount already. What we need to do is removing the old makeMounts() in kubelet_pods.go.

It should be in part of the whole removing pkg/kubelet/container/runtime.go work once docker is fully migrated to CRI.

k8s-github-robot pushed a commit that referenced this issue Oct 5, 2016
Automatic merge from submit-queue

CRI: Remove the mount name and port name.

Per discussion on #33873.

Currently the mount name is not being used and also involves some
incorrect usage (sometimes it's referencing a mount name, sometimes
it's referecing a volume name), so we decide to remove it from CRI.

The port name is also not used, so remove it as well.

Fix #33873
Fix #33526 

/cc @kubernetes/sig-node @kubernetes/sig-rktnetes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
sig/node Categorizes an issue or PR as relevant to SIG Node.
Projects
None yet
Development

No branches or pull requests

4 participants