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

Adapt WorkspaceLoader to workspaces created with Devfile #13201

Closed
sleshchenko opened this issue Apr 22, 2019 · 1 comment
Closed

Adapt WorkspaceLoader to workspaces created with Devfile #13201

sleshchenko opened this issue Apr 22, 2019 · 1 comment
Assignees
Labels
kind/task Internal things, technical debt, and to-do tasks to be performed.

Comments

@sleshchenko
Copy link
Member

sleshchenko commented Apr 22, 2019

Description

There is added an ability to create a workspace with Devfile instead of WorkspaceConfig, and in such case, WorkspaceLoader is not able to start a workspace because it expects WorkspaceConfig be present in workspace.
It is needed to rework WorkspaceLoader to use Devfile from workspace if WorkspaceConfig is absent.

Reproduction Steps

  1. Create a workspace with Devfile via swagger ${CHE_HOST}/swagger/#!/workspace/createFromDevfile.
Devfile JSON
{
  "specVersion": "0.0.1",
  "name": "with-devfile",
  "projects": [
    {
      "name": "nodejs-mongo-app",
      "source": {
        "type": "git",
        "location": "https://github.com/ijason/NodeJS-Sample-App.git"
      }
    }
  ],
  "components": [
    {
      "name": "theia-editor",
      "type": "cheEditor",
      "id": "org.eclipse.che.editor.theia:1.0.0"
    },
    {
      "name": "exec-plugin",
      "type": "chePlugin",
      "id": "che-machine-exec-plugin:0.0.1"
    },
    {
      "name": "mongodb",
      "type": "dockerimage",
      "image": "mongo",
      "endpoints": [
        {
          "name": "mongo",
          "port": 27017,
          "attributes": {
            "public": "false",
            "discoverable": "true"
          }
        }
      ],
      "mountSources": false,
      "volumes": [
        {
          "name": "mongo-storage",
          "containerPath": "/data/db"
        }
      ],
      "memoryLimit": "250Mi"
    },
    {
      "name": "nodejs-app",
      "type": "openshift",
      "reference": "node-js.yaml",
      "referenceContent": "apiVersion: v1\nkind: List\nitems:\n-\n  apiVersion: apps/v1\n  kind: Deployment\n  metadata:\n    name: web\n    labels:\n      app: nodejs\n  spec:\n    replicas: 2\n    selector:\n      name: web\n    template:\n      metadata:\n        labels:\n          app: nodejs\n        name: web-controller\n      spec:\n        containers:\n        - image: node:0.10.40\n          command: ['tail', '-f', '/dev/null']\n          args: []\n          name: web\n          ports:\n          - containerPort: 3000\n            name: http-server\n          volumeMounts:\n           - mountPath: /projects\n             name: projects\n        volumes:\n         - name: projects\n           persistentVolumeClaim:\n             claimName: projects\n- apiVersion: v1\n  kind: PersistentVolumeClaim\n  metadata:\n    name: projects\n  spec:\n    accessModes:\n     - ReadWriteOnce\n    resources:\n      requests:\n        storage: 2Gi\n-\n  apiVersion: v1\n  kind: Service\n  metadata:\n    name: web\n    labels:\n      name: web\n  spec:\n    type: LoadBalancer\n    ports:\n      - name: web\n        port: 80\n        targetPort: 3000\n        protocol: TCP\n    selector:\n      app: nodejs\n- apiVersion: v1\n  kind: Route\n  metadata:\n    name: che\n  spec:\n    to:\n      kind: Service\n      name: web\n    port:\n      targetPort: web\n"
    }
  ],
  "commands": [
    {
      "name": "run",
      "actions": [
        {
          "type": "exec",
          "component": "nodejs-app",
          "command": "cd ${CHE_PROJECTS_ROOT}/nodejs-mongo-app/EmployeeDB/ && npm install && node app.js"
        }
      ]
    }
  ]
}
2. Try to start a workspace by opening `$CHE_HOST`/che/with-devfile
@akurinnoy
Copy link
Contributor

@sleshchenko, opening ${CHE_HOST}/che/with-devfile in browser calls gwt-ide loader. I looked into it and didn't find such code which tries to grab a workspace configuration or to start a workspace. The loader expects for a workspace to be in the running state. I only found and fixed a smal bug for loader not to get machines in case of stopped workspace.

I close this issue in favor of this one #13293.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/task Internal things, technical debt, and to-do tasks to be performed.
Projects
None yet
Development

No branches or pull requests

3 participants