entrypoint.sh script: Add semaphore to prevent parallel installation of files in Kubernetes
Using this image for my kubernetes cluster @ home. Works really nice :)
Only caveat is that in case you deploy the image while using the same NFS persistent directory for all instances, they all install into the same NFS share at almost the same time. From experience, this screams to "cause" heavoc when murphy decides and I absolutely don't want it to happen.
Any chance we could add a semaphore to trigger the installer options? (Of course any other mitigation is welcome) First instance that gets the semaphore installs, the others wait for the semaphore to be released to continue operation. It could he combined with a version-check and/or date or status check to see if the installation was done right. We can link it to KUBERNETES_ENV == SET (that's when kubernetes is set).
This is an (even more major) issue for updates as well.
I'm using the fpm-alpine image as replicated handlers. Now, if I want to update my installation, I first need to scale the pods down to 1 to make sure, only one container is running the update.
Some kind of "locking" the installation really would help here. I think, for installing and updating it would be the same.
The container should not be copying the source files of the application around to begin with.
Still would want the semaphore to avoid running occ upgrade more than once.
Fixed in #1760 & #1905