-
Notifications
You must be signed in to change notification settings - Fork 13
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
Volumes and Volume Mounts #108
Comments
I spent some time debugging this and found a simple workaround. if we mount volume under this is because spin-oci-loader copies the static assets from oci artifact to the dir but this also means we need to check if oci artifacts overrides the volume if they have same files/folders. |
I further tried with volume mount a file which already exist in spin-app oci artifact, and got following error:
maybe we can update oci-loader to skip writing the path if it already exist? (but what will happen if its a directory with different content). I think we need to define what should be the expected behavior here and take it from there. |
I believe what might be happening here is that we have two different file systems: the container file system and the wasm filesystem. Kuberentes/containerd are handling the volume mounts into the container but the spin shim isn't taking those volume mounts and mapping them into the wasm file system. In runwasi's wasmtime, we we've kind of skirted around this by mounting the entire container filesystem into the wasm file system: https://github.com/containerd/runwasi/blob/0f7817ab3e0c5d4f6b1bd3182ddc65bdf957f315/crates/containerd-shim-wasmtime/src/instance.rs#L304 I don't think this is what we necessarily want, we probably want to take specific volume mounts and copy them into the wasmfile system |
Using Kubernetes volumes from within a Spin App would unlock plenty scenarios. Unfortunately, this is currently not possible, because trying to read files from guest code (although access has been granted) results in file not found errors.
For repro I created the following repository: https://github.com/ThorstenHans/tmp--spinkube-volume-mounts
Code Flow
For every incoming request the code does the following
/mount/.gitkeep
and prints the content tostdout
/mount/secrets/some
and prints the content tostdout
The
mount
foldermount
folder is part of the repository (required to makespin registry push
workmount/.gitkeep
file is part of the repositorymount/secrets
folder is created upon deployment using avolumeMount
(the underlyingvolume
references a Kubernetes SecretReproducing the Error
kubectl apply -f kubernetes/secret.yaml
spin oci --build ttl.sh/spinapp-volume-repro:2h
kubernetes/spinapp.yaml
kubectl apply -f kubernetes/spinapp.yaml
kubectl port-forward svc/repro 8080:80
curl -iX GET http://localhost:8080
kubectl logs -l core.spinoperator.dev/app-name=repro
Run setup verification Pod
The repo also contains a regular Pod to verify volume mount is working.
kubectl apply -f kubernetes/pod.yaml
kubectl exec -it repro-pod /bin/bash
cat /mount/secrets/some
Investigations on the underling Kubernetes Node
The text was updated successfully, but these errors were encountered: