Description
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
.