[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: Persistent Volumes



In order to avoid this conflict you can modify the template so it always creates a random name for your pvc:

1 -Download a fresh mysql-persistent template:

  $ oc export templates/mysql-persistent -o yaml > mysql-persistent-custom.yaml

2 - Open mysql-persistent-custom.yaml on a real text editor (vim, obviously ;) and update accordingly:

  ->PersistentVolumeClaim.metadata.name: "${DATABASE_SERVICE_NAME}-${PVC_SUFFIX}"
  -> DeploymentConfig.spec.template.spec.volumes.name.persistentVolumeClaim.claimName: "${DATABASE_SERVICE_NAME}-${PVC_SUFFIX}"

3 - Add to "parameters":

  - description: Suffix for pvc names
    from: [A-Z0-9]{6}
    generate: _expression_
    name: PVC_SUFFIX
    required: true

4 - Optionally, create a new template:

  $ oc create -f mysql-persistent-custom.yaml

It should appear in web console.

Keep in mind that everytime you use this template, a new pvc is created. It's up to yout delete it after using.


​Regards,   


Mateus Caruccio
Master of Puppets
+55 (51) 8298.0026
gtalk: mateus caruccio getupcloud com
twitter: @MateusCaruccio

This message and any attachment are solely for the intended
recipient and may contain confidential or privileged information
and it can not be forwarded or shared without permission.
Thank you!

On Fri, Feb 5, 2016 at 10:37 AM, Mark Turansky <mturansk redhat com> wrote:
The PVC is created as part of the template, so the naming conflict makes sense.

On Fri, Feb 5, 2016 at 6:59 AM, Mateus Caruccio <mateus caruccio getupcloud com> wrote:
The only way (that I known) is to delete the pvc pior creating from template again:

$ oc delete pvc/same-name

Now you can use your template.

Mateus Caruccio
Master of Puppets
+55 (51) 8298.0026
gtalk: mateus caruccio getupcloud com
twitter: @MateusCaruccio

This message and any attachment are solely for the intended
recipient and may contain confidential or privileged information
and it can not be forwarded or shared without permission.
Thank you!

On Fri, Feb 5, 2016 at 8:57 AM, Alejandro Nieto Boza <ale90nb gmail com> wrote:
But if I don't delete the PVC, when I launch the template mysql-persistent-template again with the same name to use the same volume, this error appears:

Cannot create persistentvolumeclaims. persistentvolumeclaims "same-name" already exists.


Is there any way to launch an application named "Gandalf" from mysql-persistent-template, delete this application, and launch again the same application with the same name "Gandalf" for using the same PVC "Gandalf"?

El lun., 1 feb. 2016 a las 14:30, Mark Turansky (<mturansk redhat com>) escribió:
Yes, you can re-use the same volume by not deleting the PVC.  The lifecycle of a claim is independent of a pod's lifecycle.  You can create and delete pods all day long using the same claim, but once you delete the claim, you are relinquishing your hold on that volume, hence it is Released.

Mark

On Mon, Feb 1, 2016 at 8:08 AM, Alejandro Nieto Boza <ale90nb gmail com> wrote:
Hi,

I create the following NFS PV in Openshift:

apiVersion: "v1"
kind: "PersistentVolume"
metadata:
  name: "pv01"
spec:
  capacity:
    storage: "5Gi"
  accessModes:
    - "ReadWriteOnce"
  nfs:
    path: "/mnt"
   server: "..."

Then, I create a pod with mysql-persistent-template and the pod uses correctly the PV and the PV appears "Bound". 
Now I delete the pod and the PVC. When I delete the PVC the PV appears "Released". 
Now I want to launch the same template mysql-persistent and I want the new pod uses the same PV but the PV doesn't appear "Available" again.
Is there any way to use the same volume?

Thanks.

_______________________________________________
users mailing list
users lists openshift redhat com
http://lists.openshift.redhat.com/openshiftmm/listinfo/users



_______________________________________________
users mailing list
users lists openshift redhat com
http://lists.openshift.redhat.com/openshiftmm/listinfo/users





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]