Skip to content
This repository has been archived by the owner on Jan 23, 2023. It is now read-only.

[WIP] Made several changes in Devfile format #2

Closed

Conversation

sleshchenko
Copy link
Collaborator

This PR contains the following changes that are in separate commits:

  • Change 'version' field name to 'specVersion' to be sync with implemented format
  • Change using composeFile to KubernetesList since compose is not supported by K8s/OS infras yet
  • Update dockerimage tool fields to be the same as che-plugin.yaml uses

If reviewers are OK with proposed changes I will update plantuml diagrams and remove WIP status.

@sleshchenko
Copy link
Collaborator Author

I don't have permissions to request a review in this repository.
So, @mshaposhnik, @skabashnyuk, @l0rd please take a look and comment

Copy link
Contributor

@l0rd l0rd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you very much @sleshchenko for this PR. This really helps.

petclinic.yaml Outdated Show resolved Hide resolved
petclinic.yaml Outdated
- name: spring-boot
port: 8080
mountProjectsSources: true
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I understand that you remove that because you have moved it to the volumes section. But the problem with this approach is that the user need to know Che internals (i.e. that Che does the cloning in /projects/) and ideally I would like to avoid that.
So while I am perfectly fine if we don't implement mountProjectSources in Phase 1 I would want us to implement it in the future.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(i.e. that Che does the cloning in /projects/)

It doesn't clone projects to /projects/ but it clones projects to volume with name projects. So, a user is able to specify any mountPath he wishes.

I removed mountProjectSources to have the same format as che-plugin uses. We can consider adding mountProjectSources to both of Devfile and che-plugin. Or you think that it is more critical for Devfile but it is not an issue for che-plugin.yaml?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it clones projects to volume with name projects. So, a user is able to specify any mountPath he wishes.

I am probably a n00b Che user but I wasn't aware of this convention. And we should make things easier to understand for n00bs like me.

I agree with you that che_plugin.yaml and devfile should share the same spec so +1 to update/review both models. I think this example has helped us to identify some problems with che_plugin.yaml and that's an opportunity to improve it. I have created eclipse-che/che#12249 to track that.

petclinic.yaml Outdated
- name: spring-boot
port: 8080
mountProjectsSources: true
public: true
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should be careful adding too many fields here. The main goal is to make it simple to write a Devfile. For instance fields public and attributes should be optional.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

question, why public is not an attribute (for example secure is an attribute) ?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should be careful adding too many fields here. The main goal is to make it simple to write a Devfile. For instance fields public and attributes should be optional.

Actually, public and attributes are optional fields. true is a default value for public field.

question, why public is not an attribute (for example secure is an attribute) ?

The same answer as for the next question #2 (comment).
So, let's discuss whether che-plugin.yaml and Devfile should use the same terms and structure or not. If yes, could we update che-plugin.yaml model with your proposals?

@l0rd l0rd requested review from gorkem and benoitf December 19, 2018 11:18
petclinic.yaml Outdated
port: 8080
mountProjectsSources: true
public: true
targetPort: 8080
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why targetPort instead of port ? (I mean, if I have to write the file I prefer to use short names)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agree with you. Good question. But probably this question is more to @garagatyi @skabashnyuk @l0rd since I just copied che-plugin.yaml format.
We could have different formats for Devfile and che-plugin.yaml but I prefer to use the same terms not to confuse users each time when it switch between writing workspace configuration and plugin configuration.
So, we can consider updating the model of che-plugin.yaml before Che 7 Beta release.

petclinic.yaml Outdated
- name: maven-repo
containerPath: /root/.m2
services:
mountPath: /root/.m2
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hello, what is the meaning of mountPath ?
For a volume it's always something mounted no ?

How is handled subpath BTW ?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it is path where volume folder will be mounted inside of container

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in k8s I have the ability to specify subpath:

volumeMounts:
      - mountPath: /var/lib/mysql
        name: site-data
        subPath: mysql

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@benoitf Sorry, I missed your third question.
It's right. subPath feature was not implemented. If it is important on this stage we can register an issue for add subPath feature to Che Volumes, now it has only name(key of map where it is stored) and mountPath (which is called path there) https://github.com/eclipse/che/blob/07263f1e30089689d71b057f747a44a29283e3c4/core/che-core-api-model/src/main/java/org/eclipse/che/api/core/model/workspace/config/Volume.java#L19

Does

it is path where volume folder will be mounted inside of container

answer your questions

what is the meaning of mountPath ?
For a volume it's always something mounted no ?

?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thx @sleshchenko
maybe we could agree on the model first and then see which optional field would be or not implemented ?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe we could agree on the model first and then see which optional field would be or not implemented ?

Sure. If we are talking about model I think it makes sense to consider adding subpath to CheVolume, che-plugin.yaml and Devfile.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we have subpath how we would implement that ono OSIO when subpaths already used for separating workspaces, volumes of workspaces. Would we also use the third level of nesting?

petclinic.yaml Outdated
containerPath: /root/.m2
services:
mountPath: /root/.m2
- name: projects
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agree with @l0rd it would be easier to not to write /projects and let that to the implementation to decide on which path it's coming)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

well, a user is able to specify any path he needs for projects folder to be mounted inside of his container.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure we're speaking of the same thing. User can specify all the mount volumes he might want. But if I mount /projects I expect that all ppl mounting projects source-tree will have the same data across the workspace and not get their own volume as well.

Also if plug-ins or IDE are using /projects folder but you mount /foobar then it will not behave as you are expecting as well.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

User can specify all the mount volumes he might want. But if I mount /projects I expect that all ppl mounting projects source-tree will have the same data across the workspace and not get their own volume as well.

Che Volumes should mount the same data if volumes name is the same.
And also the user is able to mount volume where he needs it to be mount inside of a container.
Example:

  - name: mvn-stack
    type: dockerImage
    image: maven:3.5.4-jdk-8
    entryPoint: sleep infinity
    volumes:
      - name: maven-repo
        mountPath: /root/.m2
  - name: gradle-stack
    type: dockerImage
    image: gradle:3.5.4-jdk-8
    entryPoint: sleep infinity
    volumes:
      - name: maven-repo
        mountPath: /home/user/.m2

mvn-stack and gradle-stack tools should have the same data but mount to different paths.
It is how I understand the format described by @l0rd. Maybe it is not related to Che Volumes (what would be confusing) at all.

petclinic.yaml Outdated Show resolved Hide resolved
@sleshchenko
Copy link
Collaborator Author

Part of changes are merged in #3
Another part of changes proposed in the PR and by reviewers should be done in eclipse-che/che#12249

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

Successfully merging this pull request may close these issues.

7 participants