Hi.Here's what I'm trying to set up :* An app which handle files, let's say profile pictures. A volume mount is used.* A single staging environment. The app is not yet in production.* A CD pipeline with Jenkins, to automatically apply updated k8s configuration (with new docker image verions of the app).* A way to copy some profile pictures versionned with git on the volume mount. Those pictures are copied in the app image (Dockerfile) during the CD step.
The goal is to reset (or reload) the mount with the versionned pictures in git, everytime a commit is done on the staging branch.My question is about the last point :* how can I trigger the copy ?* should I use a job ?
Instead of bundling the app with the images you could use a gitRepo volume and have the directory directly populated: http://kubernetes.io/docs/user-guide/volumes/#gitrepo
I would create a container that polls or listens to git webhooks and updates the gitRepo volume. Then it would roll the application deployment once the volume was updated.There isn't an off the shelf chunk of code that will do this for you unfortunately. You would need to string it together with some poll/webhook code and the Kubernetes client or API.
Another, potentially easier, way to tackle this would be to create a container and schedule it in the same pod in your app. The container would simply have a git client inside of it and execute a bash script that does a pull on some interval:`while true; do git clone https://git.repo/photos.git photos; git pull https://git.repo/photos.git staging; sleep 10; done`
Instead of bundling the app with the images you could use a gitRepo volume and have the directory directly populated: http://kubernetes.io/docs/user-guide/volumes/#gitrepo
I would create a container that polls or listens to git webhooks and updates the gitRepo volume. Then it would roll the application deployment once the volume was updated.
There isn't an off the shelf chunk of code that will do this for you unfortunately. You would need to string it together with some poll/webhook code and the Kubernetes client or API.