-
Notifications
You must be signed in to change notification settings - Fork 348
Return error if host path does not exist. #800
Return error if host path does not exist. #800
Conversation
Signed-off-by: Lantao Liu <[email protected]>
@@ -596,18 +595,9 @@ func (c *criService) addOCIBindMounts(g *generate.Generator, mounts []*runtime.M | |||
for _, mount := range mounts { | |||
dst := mount.GetContainerPath() | |||
src := mount.GetHostPath() | |||
// Create the host path if it doesn't exist. |
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.
looks like critools validate has a test for it as well..
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.
--- FAIL: TestVolumeCopyUp (0.98s)
volume_copy_up_test.go:36: Create a sandbox
volume_copy_up_test.go:45: Pull test image
volume_copy_up_test.go:49: Create a container with volume-copy-up test image
Error Trace: volume_copy_up_test.go:56
Error: Received unexpected error rpc error: code = Unknown desc = failed to generate container "58ad4ee98ed27339f6a1268826e90e9c94ca49009082effbe5fd8c6cc27d5636" spec: failed to set OCI bind mounts [&Mount{ContainerPath:/etc/hosts,HostPath:/var/lib/containerd/io.containerd.grpc.v1.cri/sandboxes/94735eb58912b9fbb0955e5c4b681b16e13a56c8eca9a9bc71a308a9e1b30c2b/hosts,Readonly:false,SelinuxRelabel:false,Propagation:PROPAGATION_PRIVATE,} &Mount{ContainerPath:/etc/resolv.conf,HostPath:/var/lib/containerd/io.containerd.grpc.v1.cri/sandboxes/94735eb58912b9fbb0955e5c4b681b16e13a56c8eca9a9bc71a308a9e1b30c2b/resolv.conf,Readonly:false,SelinuxRelabel:false,Propagation:PROPAGATION_PRIVATE,} &Mount{ContainerPath:/dev/shm,HostPath:/run/containerd/io.containerd.grpc.v1.cri/sandboxes/94735eb58912b9fbb0955e5c4b681b16e13a56c8eca9a9bc71a308a9e1b30c2b/shm,Readonly:false,SelinuxRelabel:false,Propagation:PROPAGATION_PRIVATE,} &Mount{ContainerPath:/test_dir,HostPath:/var/lib/containerd/io.containerd.grpc.v1.cri/containers/58ad4ee98ed27339f6a1268826e90e9c94ca49009082effbe5fd8c6cc27d5636/volumes/2678776edd0d0b527316a895c28eb96e77c8e7f7df93946d833277f24fecd4f9,Readonly:false,SelinuxRelabel:false,Propagation:PROPAGATION_PRIVATE,}]: failed to stat "/var/lib/containerd/io.containerd.grpc.v1.cri/containers/58ad4ee98ed27339f6a1268826e90e9c94ca49009082effbe5fd8c6cc27d5636/volumes/2678776edd0d0b527316a895c28eb96e77c8e7f7df93946d833277f24fecd4f9": stat /var/lib/containerd/io.containerd.grpc.v1.cri/containers/58ad4ee98ed27339f6a1268826e90e9c94ca49009082effbe5fd8c6cc27d5636/volumes/2678776edd0d0b527316a895c28eb96e77c8e7f7df93946d833277f24fecd4f9: no such file or directory
FAIL
./hack/test-utils.sh: line 53: 15306 Terminated keepalive "sudo PATH=${PATH} ${ROOT}/_output/containerd ${CONTAINERD_FLAGS}" ${RESTART_WAIT_PERIOD} &> ${report_dir}/containerd.log
make: *** [test-integration] Error 1
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.
Have a PR, didn't get time to send out before lunch.
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.
This behavior is not finalized. |
Follow CRI definition. See kubernetes/kubernetes#61460
Since kubernetes/kubernetes#52318 was in Kubernetes 1.8, kubelet should have made sure host path exist since that. It is safe to return error.
Signed-off-by: Lantao Liu [email protected]