In this blog post, we will present the benefits of using VSCode extensions within Eclipse Che 7, using as an example the VSCode Kubernetes Tools.
One of the goals of Eclipse Che 7 is to allow developers to use any supported editor to work on their projects. A developer would still be able to share their development environment with their team, but would be able to use their preferred editor for coding. Today, it is possible to choose from a few editors: Eclipse Theia IDE, the traditional Eclipse desktop IDE, Jupyter IDE, or Eclipse Dirigible IDE.
VSCode in the Cloud
One of the most widely used code editors today is VSCode. It is really fast, has minimal UI, is language agnostic, and provides an active plugins ecosystem. In Eclipse Che 7, we use Eclipse Theia as the default code editor. Theia provides a very similar user experience to VSCode.
At Red Hat, we have been leading the work to ensure that VS Code extensions can be run with Theia. Currently, you can install any extension from the VSCode Marketplace that uses the API calls that are already covered in Theia, e.g. Workspace API, Languages API, Debugger API, Tasks API.
Running VSCode Extensions in Isolated Containers
You might ask: “Why should I run a VS Code extension with Eclipse Che, when I can use VSCode instead?”
First of all, with Che, there is no need to install the extension dependencies like the build system, editor, VCS, etc…They can be pre-packaged in a container image where the extension will run.
Second, Eclipse Che is a true Kubernetes-native development environment — it runs directly inside your enterprise cluster on any Kubernetes (including Red Hat OpenShift).
As a result, you can have a central Kubernetes cluster for your development teams and anyone in the team can immediately get access to a fully setup developer workspace pod without having to spend time installing or configuring anything.
The Kubernetes Plugin
The Eclipse Che Kubernetes Plugin uses VSCode Kubernetes Tools with all the required dependencies, e.g.
kubectl, already packaged into the plugin’s own container.
In the following short video, you can see a sample Node.js project imported into a Che 7 workspace, with the Che Kubernetes Plugin activated and running on a local Kubernetes cluster. The video demonstrates:
- Containerizing an application and deploying it into the cluster;
- Checking on the app post-deployment;
- Iterating and deploying a new version.
Under the Hood, How Does it Work?
In this section, we’ll take a closer look at how Che plugins work.
Eclipse Che 7 managed workspaces very differently from previous versions. One of the key aspects of the new workspace model is that the IDE and developer tools run in separate sidecar containers from the main workspace runtime. Here are a few benefits of this architecture:
- simple packaging — Che 7 plugins are actually microservices packaged in their own sidecar containers, bringing their own dependencies;
- plugin execution is isolated from the other tools and from application containers;
- each plugin has its own lifecycle.
Anatomy of a Che Plugin
How does Che know which plugins to install into your workspace and where to get it? There are two main steps that Eclipse Che follows when running a Che Plugin consists of two steps:
- look for plugin meta-data;
- start a plugin sidecar container.
We can tell Che which plugins we want to use in our development environment as part of the configuration of a workspace. When the Che Server starts a workspace, it looks for the metadata for the desired plugins on the Che plugin registry (see Che Plugin Registry).
If you are developing a new plugin which is not yet included in the registry, it is possible to specify a link to the plugin metadata. In fact, we used this method in the earlier example using a Devfile.
This metadata is then passed to the Che Plugin Broker, which starts a sidecar container, and downloads the plugin files if necessary. If the Che plugin includes a VSCode extension for Theia editor, for example, the broker will download the extension from the VSCode marketplace and start it in a sidecar container.
Theia Plugin API for VSCode Kubernetes Tools
To allow VSCode Kubernetes Tools to be run inside of Eclipse Che, we have implemented most of the VSCode Plugin APIs for Eclipse Theia, including:
- Workspace APIs;
- Window APIs;
- Debug APIs;
- Language APIs;
- contribution points for views, menus, configurations, languages, debuggers.
Try the Kubernetes Plugin Today!
If you’re eager to try the Che Kubernetes Plugin yourself, here are the detailed instructions on installing and running it in the latest version of Eclipse Che — https://github.com/azatsarynnyy/blog-files/blob/master/k8s-plugin/try.md
Let me know in the comments if you have any feedback or questions regarding Eclipse Che, Eclipse Theia, Che Plugins or Theia Plugins. Also, don’t hesitate to reach out to me on Twitter.
In case you’ve faced some issues or has any ideas related to some projects used in this article, below are the links:
- Eclipse Che: https://github.com/eclipse/che
- Chectl: https://github.com/che-incubator/chectl
- Che Devfile: https://github.com/redhat-developer/devfile
- Eclipse Theia: https://github.com/theia-ide/theia
- Che Plugin Registry: https://github.com/eclipse/che-plugin-registry
- Che Plugin Broker: https://github.com/eclipse/che-plugin-broker
Try Eclipse Che 7 Now!
Want to give a try to the new version of Eclipse Che 7? Try the following:
Click on the following factory URL: https://che.openshift.io/f?id=factoryvbwekkducozn3jsn
Or Create your account on che.openshift.io, create a new workspace and select “Che 7” stack.
You can also test that locally, by installing the latest version of Eclipse Che: Quick Start with Eclipse Che.
Join the community:
- Support: You can ask questions, report bugs, and request features using GitHub issues.
- Public Chat: Join the public eclipse-che Mattermost channel to discuss with community and contributors.
- Weekly Meetings: Join us in our Che community meeting every second Monday.
Mailing list: firstname.lastname@example.org