mirror of
https://github.com/k3s-io/kubernetes.git
synced 2026-01-06 07:57:35 +00:00
Windows: Fixes termination-file mounting for containerd
If Containerd is used on Windows, then we can also mount individual files into containers (e.g.: termination-log files), which was not possible with Docker. Checks if the container runtime is containerd, and if it is, then also mount the termination-log file.
This commit is contained in:
@@ -471,9 +471,10 @@ func (kl *Kubelet) GenerateRunContainerOptions(pod *v1.Pod, container *v1.Contai
|
||||
}
|
||||
opts.Mounts = append(opts.Mounts, mounts...)
|
||||
|
||||
// Disabling adding TerminationMessagePath on Windows as these files would be mounted as docker volume and
|
||||
// Docker for Windows has a bug where only directories can be mounted
|
||||
if len(container.TerminationMessagePath) != 0 && runtime.GOOS != "windows" {
|
||||
// adding TerminationMessagePath on Windows is only allowed if ContainerD is used. Individual files cannot
|
||||
// be mounted as volumes using Docker for Windows.
|
||||
supportsSingleFileMapping := kl.containerRuntime.SupportsSingleFileMapping()
|
||||
if len(container.TerminationMessagePath) != 0 && supportsSingleFileMapping {
|
||||
p := kl.getPodContainerDir(pod.UID, container.Name)
|
||||
if err := os.MkdirAll(p, 0750); err != nil {
|
||||
klog.Errorf("Error on creating %q: %v", p, err)
|
||||
|
||||
Reference in New Issue
Block a user