Re: [kubernetes-users] How to perform automatic data copy/reset with Kubernetes ?

2016-09-16 Thread Pierrick

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

Interesting. The pictures are already checked out from git during the 
jenkins build (same repo as my app). I'd prefer not relying on git 
somewhere else in the cluster.
 

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

Right. For now, I'll try to make it simple :
 * one replica for my app pod
 * one google persistent volume for the pictures, mounted in the app pod
 * after each roll out, I'll manually run a command in the app container to 
perform the copy (from app/fixtures/*.jpg to /my-volume/pictures)

Later, I'm wondering if something more sophisticated (but 
resilient/efficient) can be possible : 
 * possibly several replicas of my app pod
 * a flocker-based volume mount
 * a jenkins job, lauchable on demand to command the copy

How does that sound ?

Cheers,

>

-- 
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 kubernetes-users+unsubscr...@googlegroups.com.
To post to this group, send email to kubernetes-users@googlegroups.com.
Visit this group at https://groups.google.com/group/kubernetes-users.
For more options, visit https://groups.google.com/d/optout.


Re: [kubernetes-users] How to perform automatic data copy/reset with Kubernetes ?

2016-09-15 Thread Derek Mahar
On Thursday, 15 September 2016 08:51:47 UTC-4, Brandon Philips wrote:

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

Is it also possible to use a Git repository from an SSH source and specify 
a private key and optional secret?  The only example in the documentation 
shows a repository URL that uses the git protocol.

Derek

-- 
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 kubernetes-users+unsubscr...@googlegroups.com.
To post to this group, send email to kubernetes-users@googlegroups.com.
Visit this group at https://groups.google.com/group/kubernetes-users.
For more options, visit https://groups.google.com/d/optout.


Re: [kubernetes-users] How to perform automatic data copy/reset with Kubernetes ?

2016-09-15 Thread Derek Mahar
On Thursday, 15 September 2016 08:51:47 UTC-4, Brandon Philips wrote:
>
> 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
>

When does the gitRepo volume clone the Git repository?  In the case where 
cluster nodes have no access to the Internet or any other host outside the 
cluster (or the cluster shouldn't make any external connections), is it 
possible to clone the Git repository before the volume is created or 
mounted? 


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

How does a container update the gitRepo volume?  Is the volume a standard 
Git repository and workspace?


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

How would this differ from a gitRepo volume?

Derek

>

-- 
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 kubernetes-users+unsubscr...@googlegroups.com.
To post to this group, send email to kubernetes-users@googlegroups.com.
Visit this group at https://groups.google.com/group/kubernetes-users.
For more options, visit https://groups.google.com/d/optout.


Re: [kubernetes-users] How to perform automatic data copy/reset with Kubernetes ?

2016-09-15 Thread Brandon Philips
On Thu, Sep 15, 2016 at 3:47 AM Pierrick  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 kubernetes-users+unsubscr...@googlegroups.com.
To post to this group, send email to kubernetes-users@googlegroups.com.
Visit this group at https://groups.google.com/group/kubernetes-users.
For more options, visit https://groups.google.com/d/optout.


[kubernetes-users] How to perform automatic data copy/reset with Kubernetes ?

2016-09-15 Thread Pierrick
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 ?
 * should I use a multiple read-write consumer volume type (e.g flocker) ?

-- 
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 kubernetes-users+unsubscr...@googlegroups.com.
To post to this group, send email to kubernetes-users@googlegroups.com.
Visit this group at https://groups.google.com/group/kubernetes-users.
For more options, visit https://groups.google.com/d/optout.