Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow volumes to be shared across components #19

Closed
l0rd opened this issue Feb 6, 2020 · 7 comments · Fixed by #35
Closed

Allow volumes to be shared across components #19

l0rd opened this issue Feb 6, 2020 · 7 comments · Fixed by #35
Milestone

Comments

@l0rd
Copy link
Contributor

l0rd commented Feb 6, 2020

Odo will have a need for multiple components to mount the same volume. There isn’t an option in devfiles right now to define a volume once, and have multiple components mount that same volume.

To work around this, we’re proposing adding a way to the devfile spec that allows you to define a volume once (a top level ‘volumes’ field), then easily add it to other components via a ‘volumeMount’ field. This is similar to how Kubernetes pods handle volumes.

Example:

---
projects:
  - name: "my-project"
components:
  - container:
      image: "busybox"
      name: "mycontainer"
      memoryLimit: "128M"
      mountSources: true
      volumeMount:
        - name: my-data-volume
          path: /some/folder
  - kubernetes:
      referenceContent: |
        kind: Pod
        metadata:
          name: sample-pod
        spec:
          containers:
            image: docker.io/my-sample-image:latest
            volumeMounts:
            - mountPath: /some/path
              name: my-data-volume
  - volume:
     name: my-data-volume
     size: 5Gi
@l0rd l0rd mentioned this issue Feb 6, 2020
28 tasks
@l0rd
Copy link
Contributor Author

l0rd commented Feb 6, 2020

cc @johnmcollier @elsony

@l0rd
Copy link
Contributor Author

l0rd commented Feb 18, 2020

@johnmcollier will provide another example using a component of type Kubernetes

@sleshchenko
Copy link
Member

Does it duplicate #16 ?

There is another interesting option to think about - add an ability to specify PVC name for volume eclipse-che/che#15652

@johnmcollier
Copy link
Member

@sleshchenko Yeah it's the same, since there's already some discussion here, I'll close out my issue in favour of this one.

@johnmcollier
Copy link
Member

johnmcollier commented Feb 25, 2020

Sample with Kubernetes component:

---
projects:
  - name: "my-project"
components:
  - container:
      image: "busybox"
      name: "mycontainer"
      memoryLimit: "128M"
      mountSources: true
      volumeMount:
        - name: my-data-volume
          path: /some/folder
  - kubernetes:
      referenceContent: |
        kind: Pod
        metadata:
          name: sample-pod
        spec:
          containers:
            image: docker.io/my-sample-image:latest
            volumeMounts:
            - mountPath: /some/path
              name: my-data-volume
  - volume:
     name: my-data-volume
     size: 5Gi

In this scenario, the Kubernetes component references the my-data-volume defined in the volume section under components, rather than having to define one via a persistent volume claim in the pod spec.

@l0rd
Copy link
Contributor Author

l0rd commented Feb 25, 2020

Reviewed and approved the version provided on this comment.
We also agreed that the name field should be mandatory for volume components.

davidfestal added a commit that referenced this issue Apr 10, 2020
Signed-off-by: David Festal <dfestal@redhat.com>
davidfestal added a commit that referenced this issue Apr 22, 2020
* Implement agreement on issue #18
* Implement agreement on issue #17
* Implement agreement on issue #21
* Implement agreement on issue #22
* Implement agreement on issue #27
* Implement agreement on issue #9
* Implement agreement on issue #10
* Fix PR comments about issue #9 PR comment #35 (comment)
* Fix PR comments about issue #17 PR comment #35 (comment)
* Implement agreement on issue #14 and  #19
* Add the spring boot example
* Implement agreement on issue #32
* Fix last PR comments

Signed-off-by: David Festal <dfestal@redhat.com>

Co-Authored-By: Sergii Leshchenko <sleshche@redhat.com>
@l0rd l0rd added this to the 2.0.0 milestone Jun 16, 2020
@davidfestal davidfestal linked a pull request Jun 23, 2020 that will close this issue
@davidfestal
Copy link
Collaborator

implemented

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants