sylabs / singularity-cri

The Singularity implementation of the Kubernetes Container Runtime Interface
Apache License 2.0
114 stars 29 forks source link

Singularity-CRI should create directory when hostPath type mount is empty #354

Closed sashayakovtseva closed 5 years ago

sashayakovtseva commented 5 years ago

What are the steps to reproduce this issue?

  1. Create a pod with a hostPath volume of empty type (e.g apply calico)

What happens?

Pod fails to create:

  Warning  Failed     21m (x12 over 23m)    kubelet, ip-10-0-0-27  Error: could
not create container: could not spawn container: could not create oci bundle:
could not generate oci spec for container: could not configure mounts: invalid
bind mount source: lstat /var/lib/cni: no such file or directory

What were you expecting to happen?

Pod is successfully created.

Any logs, error output, comments, etc?

Other CRI implementations support this behavior by default:

  1. docker itself creates directories on host by default, check with docker run -it -v $PWD/not-here:/not-here alpine /bin/sh
  2. CRI-o creates empty directory if it does not exist, see this

Environment?

OS distribution and version: n/a

Singularity-CRI version: all versions

Singularity version: n/a

Kubernetes version: n/a

poidag-zz commented 5 years ago

Fantastic! Thank you @sashayakovtseva

I have tested and is working perfectly. Please let me know if there is any more information I can provide or if I can perform and futher testing for you?

ubuntu@ip-10-0-0-178:~$ uname -a
Linux ip-10-0-0-178 4.15.0-1044-aws #46-Ubuntu SMP Thu Jul 4 13:38:28 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux
ubuntu@ip-10-0-0-178:~$ singularity version
3.3.0-dirty
ubuntu@ip-10-0-0-178:~$ sycri version
1.0.0-beta.5.4.g8702b21
ubuntu@ip-10-0-0-178:~$ kubectl get po -A
NAMESPACE     NAME                                       READY   STATUS    RESTARTS   AGE
kube-system   calico-kube-controllers-7bd78b474d-kndhl   1/1     Running   0          5m14s
kube-system   calico-node-cz5m9                          1/1     Running   0          5m14s
kube-system   coredns-5c98db65d4-cgxlc                   1/1     Running   0          5m40s
kube-system   coredns-5c98db65d4-jccq6                   1/1     Running   0          5m40s
kube-system   etcd-ip-10-0-0-178                         1/1     Running   0          4m37s
kube-system   kube-apiserver-ip-10-0-0-178               1/1     Running   0          4m46s
kube-system   kube-controller-manager-ip-10-0-0-178      1/1     Running   0          4m47s
kube-system   kube-proxy-bv698                           1/1     Running   0          5m39s
kube-system   kube-scheduler-ip-10-0-0-178               1/1     Running   0          4m58s

Pete

sashayakovtseva commented 5 years ago

@pickledrick Thanks for confirming! I will appreciate any information, bug reports or improvements suggestions :)