Skip to content
This repository was archived by the owner on Mar 9, 2022. It is now read-only.

Return error if host path does not exist. #800

Conversation

Random-Liu
Copy link
Member

@Random-Liu Random-Liu commented Jun 4, 2018

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]

@@ -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.
Copy link
Member

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..

Copy link
Member

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

Copy link
Member Author

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.

Copy link
Member Author

Choose a reason for hiding this comment

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

@Random-Liu Random-Liu added the hold label Jun 5, 2018
@Random-Liu
Copy link
Member Author

This behavior is not finalized.

@dmcgowan dmcgowan closed this Mar 8, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants