Skip to content

Editor devfiles should use controller.devfile.io/container-contribution: true attribute on injectable components #21739

@amisevsk

Description

@amisevsk

Is your enhancement related to a problem? Please describe

DevWorkspace Operator PR devfile/devworkspace-operator#844 added support for two new attributes on components:

  • controller.devfile.io/container-contribution: true defines a container component as a "container contribution"
  • controller.devfile.io/merge-contribution: true defines a container as a target for merging a "container contribution"

When a component has the container-contribution: true attribute and another component has the merge-contribution: true attribute, the DevWorkspace Operator merges the former into the latter, overriding fields except for image. This is intended to support the current process of injecting the Theia or CheCode editors into an existing Devfile component, which is currently done by modifying the devfile contents when converting to a DevWorkspace. This has the issue that it's hard to get the original Devfile back from the converted form, as fields have been updated.

When merging is not possible, the original image for the merged component is used and that component is started as normal.

Describe the solution you'd like

The plugins listed in the Devfile registry should be updated to use the controller.devfile.io/container-contribution: true attribute on components intended to be "injected" into a devfile component.

  • For the CheCode editor (che-incubator/che-code/insiders), this is simple -- it is sufficient to just add the attribute to the che-code-runtime-description component
     components:
       - name: che-code-runtime-description
         attributes:
           app.kubernetes.io/component: che-code-runtime
           app.kubernetes.io/part-of: che-code.eclipse.org
    +      controller.devfile.io/container-contribution: true
         container:
           image: quay.io/devfile/universal-developer-image@sha256:53cec58dd190dd1e06100478ae879d7c28abd8fc883d5fdf5be3eb6e943fe5e7
           command:
             - /checode/entrypoint-volume.sh
  • For the Theia editor, the required additions are done by the dashboard directly and are not present in the devfile. If we want to define the additions required by the Theia editor when it is being injected into a container, one approach is to define a "dummy" component that is expected to be injected
    @@ -9,6 +9,26 @@
       preStart:
         - init-container-command
     components:
    +  - name: theia-ide-contributions
    +    attributes:
    +      controller.devfile.io/container-contribution: true
    +    container:
    +      args:
    +        - sh
    +        - '-c'
    +        - '${PLUGIN_REMOTE_ENDPOINT_EXECUTABLE}'
    +      env:
    +        - name: PLUGIN_REMOTE_ENDPOINT_EXECUTABLE
    +          value: /remote-endpoint/plugin-remote-endpoint
    +        - name: THEIA_PLUGINS
    +          value: local-dir:///plugins/sidecars/tools
    +      memoryLimit: 512Mi
    +      volumeMounts:
    +        - name: plugins
    +          path: /plugins
    +        - name: remote-endpoint
    +          path: /remote-endpoint
    +      image: quay.io/devfile/universal-developer-image@sha256:53cec58dd190dd1e06100478ae879d7c28abd8fc883d5fdf5be3eb6e943fe5e7
       - name: theia-ide
         container:
           image: quay.io/eclipse/che-theia:next
    when used with an appropriate merge target, this results in a DevWorkspace that matches what is produced by the dashboard when using the Theia IDE

Describe alternatives you've considered

It may make sense to only implement this for CheCode, as it's a lot simpler.

Additional context

This issue is part of #21736

Metadata

Metadata

Assignees

Labels

area/editorsarea/plugin-registrykind/enhancementA feature request - must adhere to the feature request template.severity/P1Has a major impact to usage or development of the system.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions