Closed
Description
Description
Currently when starting multiple clusters using the same image before the image is cached, we download the same image in parallel. The first download stores the file in the cache and the other downloaded files are dropped.
Possible flow
- Create the cache directory
- Take the cache directory lock
- If we can use the image, release the lock and use the image.
we can use it in these cases:- cached digest matches wanted digest
- cached time matches server last-modified time
- no wanted digest or cached time
- Write the metadata files
- Download to temporary file
- Rename temporary file to data file
- Release the cache directory lock
Possible issues
- stale locks - should not be possible since flock (and the windows locks) are released when the process terminates
- bug when you forget to release the lock after download - should not be possible with lockutil.WithDirLock.
- download takes too much time, maybe hang on inaccessible network - should not happen becuase of socket timeouts. Terminating limactl will abort the download or waiting on the cache directory lock.
@jandubois you was concerned about issues, anything to add?