On Thu, Sep 15, 2016 at 3:47 AM Pierrick <[email protected]> wrote:

> 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.
>

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


> 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 ?
>

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`

Hope that helps! Let us know what you come up with!

Cheers,

Brandon

>

-- 
You received this message because you are subscribed to the Google Groups 
"Kubernetes user discussion and Q&A" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/kubernetes-users.
For more options, visit https://groups.google.com/d/optout.

Reply via email to