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
Windows: Fixes /etc/hosts file mounting support for containerd #83730
Windows: Fixes /etc/hosts file mounting support for containerd #83730
Conversation
/milestone v1.17 This PR is intended to solve an issue that is in milestone 1.17. Will this PR be merged before code freeze on Nov. 14? |
@josiahbjorgaard: The provided milestone is not valid for this repository. Milestones in this repository: [ Use In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
/milestone v1.17 |
pkg/kubelet/kubelet_pods.go
Outdated
@@ -465,7 +469,9 @@ func (kl *Kubelet) GenerateRunContainerOptions(pod *v1.Pod, container *v1.Contai | |||
} | |||
opts.Envs = append(opts.Envs, envs...) | |||
|
|||
mounts, cleanupAction, err := makeMounts(pod, kl.getPodDir(pod.UID), container, hostname, hostDomainName, podIP, volumes, kl.hostutil, kl.subpather, opts.Envs) | |||
// we can only mount individual files (e.g.: /etc/hosts, termination-log files) on Windows only if we're using Containerd. | |||
isContainerd := kl.containerRuntime.Type() == kubetypes.ContainerdContainerRuntime |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
where is this set? The kubelet config / command line still just includes a remote runtime.
I'm wondering if it makes more sense to implement a function that is capability focused, rather than returning the runtime
func SupportsSingleFileMapping() bool {
switch (runtime.GOOS) {
"windows": {
return kl.containerRuntime.Type() == kubetypes.RemoteContainerRuntime
}
default: {
return true
}
}
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The container runtime is queried directly by the kubeGenericRuntimeManager
here: https://github.com/kubernetes/kubernetes/blob/master/pkg/kubelet/kuberuntime/kuberuntime_manager.go#L242
Done
Bug triage team for v1.17 here. This PR and its referenced issue need to be merged and closed by the code freeze deadline of this Thursday, end of day Pacific time in order to make the release. Otherwise, it should be bumped to v1.18. Will this PR be merged by then? |
f7f8f9f
to
9505eaa
Compare
/lgtm Thanks @BCLAU ! |
If Containerd is used on Windows, then we can also mount individual files into containers (e.g.: /etc/hosts), which was not possible with Docker. Checks if the container runtime is containerd, and if it is, then also mount /etc/hosts file (to C:\Windows\System32\drivers\etc\hosts).
b1b7b06
to
de46029
Compare
FWIW, this is how the hosts file looks in a Windows containerd container with this PR: PS: it seems to also be alright with the Windows
|
/recheck |
@claudiubelu Is this PR ready to merge? |
/sig windows |
/priority important-soon |
Yes, I've mentioned above that I've spawned some pods using this PR and another one, and the |
Hello! I am from the Bug Triage team! Friendly reminder that code freeze is starting March 9th, 2021 (less than 1 week from now). We want to ensure that each PR has a chance to be merged before code freeze. As the PR is tagged for 1.21, is it still planned for this release? |
/test pull-kubernetes-unit |
@kcmartin yes we'd like to get this merged for 1.21 |
/lgtm |
/hold cancel |
/retest Review the full test history for this PR. Silence the bot with an |
1 similar comment
/retest Review the full test history for this PR. Silence the bot with an |
What type of PR is this?
/kind bug
What this PR does / why we need it:
If Containerd is used on Windows, then we can also mount individual files into containers (e.g.:
/etc/hosts
), which was not possible with Docker.Checks if the container runtime is containerd, and if it is, then also mount
/etc/hosts
file (toC:\Windows\System32\drivers\etc\hosts
).Which issue(s) this PR fixes:
Fixes #70189
Special notes for your reviewer:
Does this PR introduce a user-facing change?:
Additional documentation e.g., KEPs (Kubernetes Enhancement Proposals), usage docs, etc.: