Skip to content

Che-Theia with DevWorkspaces sometimes overwrites the DevWorkspace in-cluster object #21244

@amisevsk

Description

@amisevsk

Describe the bug

Theia sometimes applies the contents of $DEVWORKSPACE_FLATTENED_DEVFILE to the cluster, overwriting the cluster object with its flattened equivalent. This breaks the connection between the workspace and any plugins defined in DevWorkspaceTemplates.

This has the further issue that it's harder to e.g. change the editor in the DevWorkspace as the contents of e.g. the Theia plugin are included among the original components.

Che version

next (development version)

Steps to reproduce

  1. Start a workspace via factory link che-url/#https://github.com/che-samples/golang-example/tree/devfilev2
  2. Note DevWorkspace on cluster created from this factory (e.g. golang-example-xxxx)
  3. From within Theia, use ctrl+shift+p to Git: Add Remote... and enter e.g. https://github.com/golang/example.git
  4. Check the DevWorkspace from step 2 and see that it is changed

Expected behavior

If Theia modifies the Devfile, it should use $DEVWORKSPACE_ORIGINAL_DEVFILE as a base.

Runtime

OpenShift

Screenshots

No response

Installation method

chectl/next

Environment

Linux

Eclipse Che Logs

No response

Additional context

Sample diff from following the reproducer above
--- old.spec.yaml	2022-03-09 15:13:45.637133730 -0500
+++ new.spec.yaml	2022-03-09 15:15:42.155462404 -0500
@@ -1,4 +1,9 @@
 commands:
+  - apply:
+      component: remote-runtime-injector
+    attributes:
+      controller.devfile.io/imported-by: theia-ide-workspace14549e4b9643420f
+    id: init-container-command
   - exec:
       commandLine: go get -d && go run main.go
       component: tools
@@ -32,6 +37,184 @@
     id: run-current-file
 components:
   - attributes:
+      app.kubernetes.io/component: che-theia
+      app.kubernetes.io/part-of: che-theia.eclipse.org
+      controller.devfile.io/imported-by: theia-ide-workspace14549e4b9643420f
+    container:
+      cpuLimit: 1500m
+      cpuRequest: 100m
+      endpoints:
+        - attributes:
+            controller.devfile.io/endpoint-url: https://che-eclipse-che.apps.cluster-jc4kr.jc4kr.sandbox1192.opentlc.com/workspace14549e4b9643420f/theia-ide/3100/
+            cookiesAuthEnabled: true
+            discoverable: false
+            type: main
+            urlRewriteSupported: true
+          exposure: public
+          name: theia
+          protocol: https
+          secure: false
+          targetPort: 3100
+        - attributes:
+            controller.devfile.io/endpoint-url: https://che-eclipse-che.apps.cluster-jc4kr.jc4kr.sandbox1192.opentlc.com/workspace14549e4b9643420f/theia-ide/webviews/
+            cookiesAuthEnabled: true
+            discoverable: false
+            type: webview
+            unique: true
+            urlRewriteSupported: true
+          exposure: public
+          name: webviews
+          protocol: https
+          secure: false
+          targetPort: 3100
+        - attributes:
+            controller.devfile.io/endpoint-url: https://che-eclipse-che.apps.cluster-jc4kr.jc4kr.sandbox1192.opentlc.com/workspace14549e4b9643420f/theia-ide/mini-browser/
+            cookiesAuthEnabled: true
+            discoverable: false
+            type: mini-browser
+            unique: true
+            urlRewriteSupported: true
+          exposure: public
+          name: mini-browser
+          protocol: https
+          secure: false
+          targetPort: 3100
+        - attributes:
+            controller.devfile.io/endpoint-url: https://che-eclipse-che.apps.cluster-jc4kr.jc4kr.sandbox1192.opentlc.com/workspace14549e4b9643420f/theia-ide/3130/
+            discoverable: false
+            type: ide-dev
+            urlRewriteSupported: true
+          exposure: public
+          name: theia-dev
+          protocol: http
+          targetPort: 3130
+        - attributes:
+            controller.devfile.io/endpoint-url: https://che-eclipse-che.apps.cluster-jc4kr.jc4kr.sandbox1192.opentlc.com/workspace14549e4b9643420f/theia-ide/13131/
+            discoverable: false
+            urlRewriteSupported: true
+          exposure: public
+          name: theia-redirect-1
+          protocol: http
+          targetPort: 13131
+        - attributes:
+            controller.devfile.io/endpoint-url: https://che-eclipse-che.apps.cluster-jc4kr.jc4kr.sandbox1192.opentlc.com/workspace14549e4b9643420f/theia-ide/13132/
+            discoverable: false
+            urlRewriteSupported: true
+          exposure: public
+          name: theia-redirect-2
+          protocol: http
+          targetPort: 13132
+        - attributes:
+            controller.devfile.io/endpoint-url: https://che-eclipse-che.apps.cluster-jc4kr.jc4kr.sandbox1192.opentlc.com/workspace14549e4b9643420f/theia-ide/13133/
+            discoverable: false
+            urlRewriteSupported: true
+          exposure: public
+          name: theia-redirect-3
+          protocol: http
+          targetPort: 13133
+        - attributes:
+            controller.devfile.io/endpoint-url: wss://che-eclipse-che.apps.cluster-jc4kr.jc4kr.sandbox1192.opentlc.com/workspace14549e4b9643420f/theia-ide/3333/
+            cookiesAuthEnabled: true
+            discoverable: false
+            type: collocated-terminal
+            urlRewriteSupported: true
+          exposure: public
+          name: terminal
+          protocol: wss
+          secure: false
+          targetPort: 3333
+      env:
+        - name: THEIA_PLUGINS
+          value: local-dir:///plugins
+        - name: HOSTED_PLUGIN_HOSTNAME
+          value: 0.0.0.0
+        - name: HOSTED_PLUGIN_PORT
+          value: '3130'
+        - name: THEIA_HOST
+          value: 127.0.0.1
+        - name: CHE_DASHBOARD_URL
+          value: https://che-eclipse-che.apps.cluster-jc4kr.jc4kr.sandbox1192.opentlc.com
+        - name: CHE_PLUGIN_REGISTRY_URL
+          value: https://che-eclipse-che.apps.cluster-jc4kr.jc4kr.sandbox1192.opentlc.com/plugin-registry/v3
+        - name: CHE_PLUGIN_REGISTRY_INTERNAL_URL
+          value: http://plugin-registry.eclipse-che.svc:8080/v3
+      image: quay.io/eclipse/che-theia:next
+      memoryLimit: 512M
+      mountSources: true
+      sourceMapping: /projects
+      volumeMounts:
+        - name: plugins
+          path: /plugins
+        - name: theia-local
+          path: /home/theia/.theia
+    name: theia-ide
+  - attributes:
+      controller.devfile.io/imported-by: theia-ide-workspace14549e4b9643420f
+    name: plugins
+    volume: {}
+  - attributes:
+      controller.devfile.io/imported-by: theia-ide-workspace14549e4b9643420f
+    name: theia-local
+    volume: {}
+  - attributes:
+      app.kubernetes.io/component: machine-exec
+      app.kubernetes.io/part-of: che-theia.eclipse.org
+      controller.devfile.io/imported-by: theia-ide-workspace14549e4b9643420f
+    container:
+      command:
+        - /go/bin/che-machine-exec
+        - --url
+        - 127.0.0.1:3333
+        - --idle-timeout
+        - 15m
+      cpuLimit: 500m
+      cpuRequest: 30m
+      env:
+        - name: CHE_DASHBOARD_URL
+          value: https://che-eclipse-che.apps.cluster-jc4kr.jc4kr.sandbox1192.opentlc.com
+        - name: CHE_PLUGIN_REGISTRY_URL
+          value: https://che-eclipse-che.apps.cluster-jc4kr.jc4kr.sandbox1192.opentlc.com/plugin-registry/v3
+        - name: CHE_PLUGIN_REGISTRY_INTERNAL_URL
+          value: http://plugin-registry.eclipse-che.svc:8080/v3
+      image: quay.io/eclipse/che-machine-exec:next
+      memoryLimit: 128Mi
+      memoryRequest: 32Mi
+      sourceMapping: /projects
+    name: che-machine-exec
+  - attributes:
+      app.kubernetes.io/component: remote-runtime-injector
+      app.kubernetes.io/part-of: che-theia.eclipse.org
+      controller.devfile.io/imported-by: theia-ide-workspace14549e4b9643420f
+    container:
+      cpuLimit: 500m
+      cpuRequest: 30m
+      env:
+        - name: PLUGIN_REMOTE_ENDPOINT_EXECUTABLE
+          value: /remote-endpoint/plugin-remote-endpoint
+        - name: REMOTE_ENDPOINT_VOLUME_NAME
+          value: remote-endpoint
+        - name: CHE_DASHBOARD_URL
+          value: https://che-eclipse-che.apps.cluster-jc4kr.jc4kr.sandbox1192.opentlc.com
+        - name: CHE_PLUGIN_REGISTRY_URL
+          value: https://che-eclipse-che.apps.cluster-jc4kr.jc4kr.sandbox1192.opentlc.com/plugin-registry/v3
+        - name: CHE_PLUGIN_REGISTRY_INTERNAL_URL
+          value: http://plugin-registry.eclipse-che.svc:8080/v3
+      image: quay.io/eclipse/che-theia-endpoint-runtime-binary:next
+      memoryLimit: 128Mi
+      memoryRequest: 32Mi
+      sourceMapping: /projects
+      volumeMounts:
+        - name: plugins
+          path: /plugins
+        - name: remote-endpoint
+          path: /remote-endpoint
+    name: remote-runtime-injector
+  - attributes:
+      controller.devfile.io/imported-by: theia-ide-workspace14549e4b9643420f
+    name: remote-endpoint
+    volume:
+      ephemeral: true
+  - attributes:
       app.kubernetes.io/name: tools
       che-theia.eclipse.org/vscode-extensions:
         - https://github.com/golang/vscode-go/releases/download/v0.23.0/go-0.23.0.vsix
@@ -41,7 +224,9 @@
         - -c
         - ${PLUGIN_REMOTE_ENDPOINT_EXECUTABLE}
       endpoints:
-        - exposure: public
+        - attributes:
+            controller.devfile.io/endpoint-url: http://workspace14549e4b9643420f-1.apps.cluster-jc4kr.jc4kr.sandbox1192.opentlc.com/
+          exposure: public
           name: 8080-tcp
           protocol: http
           targetPort: 8080
@@ -64,11 +249,9 @@
         - name: plugins
           path: /plugins
     name: tools
-  - name: theia-ide-workspace14549e4b9643420f
-    plugin:
-      kubernetes:
-        name: theia-ide-workspace14549e4b9643420f
-        namespace: user20-che
+events:
+  preStart:
+    - init-container-command
 projects:
   - git:
       checkoutFrom:

Metadata

Metadata

Assignees

Labels

area/editor/theiaIssues related to the che-theia IDE of Cheengine/devworkspaceIssues related to Che configured to use the devworkspace controller as workspace engine.kind/bugOutline of a bug - must adhere to the bug report template.severity/P1Has a major impact to usage or development of the system.

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions