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

Proposal: begin process of moving plugin components in DevWorkspace spec #874

Closed
amisevsk opened this issue Jun 14, 2022 · 1 comment · Fixed by #879
Closed

Proposal: begin process of moving plugin components in DevWorkspace spec #874

amisevsk opened this issue Jun 14, 2022 · 1 comment · Fixed by #879
Assignees
Labels
area/devworkspace Improvent or additions to the DevWorkspaces CRD
Milestone

Comments

@amisevsk
Copy link
Contributor

Which area this feature is related to?

/area devworkspace

Which functionality do you think we should add?

Add a new field to DevWorkspaces to store plugin components, separate from the DevWorkspace template:

  kind: DevWorkspace
  apiVersion: workspace.devfile.io/v1alpha2
  metadata:
    name: golang-sample
  spec:
    started: true
+   contributions:
+     - name: che-code
+       uri: https://gist.githubusercontent.com/amisevsk/b342b9ae064b5a79e08945d04d02c208/raw/84cd2df9266b4a608fbc0fd0cc18816bca03e344/theia-contrib.devfile.yaml
    template:
      attributes:
        controller.devfile.io/storage-type: ephemeral
      projects:
        - name: golang-sample
          git:
            remotes:
              origin: "https://github.com/che-samples/golang-example.git"
      components:
        - name: tools
          container:
            image: quay.io/devfile/universal-developer-image:ubi8-0e189d9
            env:
              - name: GOPATH
                value: /projects:/home/user/go
              - name: GOCACHE
                value: /tmp/.cache
            endpoints:
              - name: 8080-tcp
                targetPort: 8080
            memoryLimit: 2Gi
            mountSources: true

This new field would contain a list of items that contain the same information as the current plugin components, but simplified as there is no need to distinguish them from non-plugin components:

contributions:
- name: reference-by-uri
  uri: <URI to devworkspace or devfile yaml/json>

- name: reference-by-k8s
  kubernetes:
    name: <name of DevWorkspaceTemplate>
    namespace: <namespace for DWT; optional -- default is current namespace>

- name: reference-by-id
  id: <ID in a devfile registry>
  registryURL: <URL to registry containing plugin>

Contributions would also support the current plugin overriding functionality, to allow overriding components/commands in the contribution:

contributions:
- name: reference-by-uri
  uri: <URI to devworkspace or devfile yaml/json>
  components:
    - name: theia-ide
      container:
        env:
          - name: THEIA_HOST
            value: 0.0.0.0

Why is this needed? Is your feature request related to a problem?

Since plugin components were removed from the devfile schema (#333), there has been a mismatch between the DevWorkspace custom resource and Devfiles. This leads to the following issues:

  • There's not a clear line between a devfile and a devworkspace when plugins are used -- if you want to add plugins to a devfile, the devworkspace.spec.template must be modified, where it should ideally be a copy of the original Devfile
  • Converting a DevWorkspace into a Devfile requires filtering the components list for components with type plugin

This change would mean that there is a clear, distinct way to layer on additional components to existing Devfiles when creating a DevWorkspace.

The same DevWorkspace posted above, written with the current DevWorkspace CR, would instead be

  kind: DevWorkspace
  apiVersion: workspace.devfile.io/v1alpha2
  metadata:
    name: golang-sample
  spec:
    started: true
    template:
      attributes:
        controller.devfile.io/storage-type: ephemeral
      projects:
        - name: golang-sample
          git:
            remotes:
              origin: "https://github.com/che-samples/golang-example.git"
      components:
        - name: tools
          attributes:
          container:
            image: quay.io/devfile/universal-developer-image:ubi8-0e189d9
            env:
              - name: GOPATH
                value: /projects:/home/user/go
              - name: GOCACHE
                value: /tmp/.cache
            endpoints:
              - name: 8080-tcp
                targetPort: 8080
            memoryLimit: 2Gi
            mountSources: true
+       - name: che-code
+         plugin:
+           uri: https://gist.githubusercontent.com/amisevsk/b342b9ae064b5a79e08945d04d02c208/raw/84cd2df9266b4a608fbc0fd0cc18816bca03e344/theia-contrib.devfile.yaml

Additional Information

Note that even with this change, the DevWorkspace .spec.template.components still has to support components of type Plugin in v1alpha2, as removing it there would be a backwards-incompatible change. Hopefully this implementation would allow for migration away from plugin components, making it easier to (potentially) drop the plugin component type if/when we reach v1alpha3.

@amisevsk amisevsk self-assigned this Jun 14, 2022
@openshift-ci openshift-ci bot added the area/devworkspace Improvent or additions to the DevWorkspaces CRD label Jun 14, 2022
@amisevsk
Copy link
Contributor Author

cc: @l0rd

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/devworkspace Improvent or additions to the DevWorkspaces CRD
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants