Skip to content

Commit 0fbb61c

Browse files
tolushadkwon17deerskindoll
authored
feat: How to configure custom editors definitions (#2738)
* feat: How to configure custom editors definitions Signed-off-by: Anatolii Bazko <abazko@redhat.com> Co-authored-by: David Kwon <dakwon@redhat.com> Co-authored-by: Jana Vrbkova <jvrbkova@redhat.com>
1 parent 82442ee commit 0fbb61c

File tree

4 files changed

+186
-0
lines changed

4 files changed

+186
-0
lines changed

antora.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,7 @@ asciidoc:
108108
rh-os-devspaces: Red Hat OpenShift Dev Spaces
109109
rh-os-local: Red Hat OpenShift Local
110110
theia-endpoint-image: eclipse/che-theia-endpoint-runtime:next
111+
editor-definition-samples-link: link:https://github.com/eclipse-che/che-operator/tree/main/editors-definitions[Editors definitions samples]
111112
ext:
112113
collector:
113114
- run:

modules/administration-guide/nav.adoc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@
7171
*** xref:configuring-storage-sizes.adoc[]
7272
** xref:configuring-dashboard.adoc[]
7373
*** xref:configuring-getting-started-samples.adoc[]
74+
*** xref:configuring-editors-definitions.adoc[]
7475
*** xref:customizing-openshift-che-consolelink-icon.adoc[]
7576
** xref:managing-identities-and-authorizations.adoc[]
7677
*** xref:configuring-oauth-for-git-providers.adoc[]

modules/administration-guide/pages/configuring-dashboard.adoc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,7 @@
99

1010
* xref:configuring-getting-started-samples.adoc[]
1111

12+
* xref:configuring-editors-definitions.adoc[]
13+
1214
* xref:customizing-openshift-che-consolelink-icon.adoc[]
1315

Lines changed: 182 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,182 @@
1+
:_content-type: PROCEDURE
2+
:description: Configuring editors definitions
3+
:keywords: administration guide, configuring, dashboard, editors
4+
:navtitle: Configuring editors definitions
5+
:page-aliases: installation-guide:configuring-editors-definitions.adoc
6+
7+
[id="configuring-editors-definitions"]
8+
= Configuring editors definitions
9+
10+
Learn how to configure {prod-short} editor definitions.
11+
12+
.Prerequisites
13+
14+
* An active `{orch-cli}` session with administrative permissions to the {orch-name} cluster. See {orch-cli-link}.
15+
16+
.Procedure
17+
18+
. Create the `my-editor-definition-devfile.yaml` YAML file with the editor definition configuration.
19+
+
20+
[IMPORTANT]
21+
====
22+
Make sure you provide the actual values for `publisher` and `version` under `metadata.attributes`.
23+
They are used to construct the editor id along with editor name in the following format `publisher/name/version`.
24+
====
25+
+
26+
Below you can find the supported values, including optional ones:
27+
+
28+
[source,yaml,subs="+quotes,+attributes"]
29+
----
30+
# Version of the devile schema
31+
schemaVersion: 2.2.2
32+
# Meta information of the editor
33+
metadata:
34+
# (MANDATORY) The editor name
35+
name: EditorName
36+
displayName: Display Name
37+
description: Run Editor Foo on top of Eclipse Che
38+
# (OPTIONAL) Array of tags of the current editor. The Tech-Preview tag means the option is considered experimental and is not recommended for production environments. While it can include new features and improvements, it may still contain bugs or undergo significant changes before reaching a stable version.
39+
tags:
40+
- Tech-Preview
41+
# Additional attributes
42+
attributes:
43+
title: This is my editor
44+
# (MANDATORY) The publisher name
45+
publisher: publisher
46+
# (MANDATORY) The editor version
47+
version: version
48+
repository: https://github.com/editor/repository/
49+
firstPublicationDate: '2024-01-01'
50+
iconMediatype: image/svg+xml
51+
iconData: |
52+
__<icon-content>__
53+
# List of editor components
54+
components:
55+
# Name of the component
56+
- name: che-code-injector
57+
# Configuration of devworkspace-related container
58+
container:
59+
# Image of the container
60+
image: 'quay.io/che-incubator/che-code:insiders'
61+
# The command to run in the dockerimage component instead of the default one provided in the image
62+
command:
63+
- /entrypoint-init-container.sh
64+
# (OPTIONAL) List of volumes mounts that should be mounted in this container
65+
volumeMounts:
66+
# The name of the mount
67+
- name: checode
68+
# The path of the mount
69+
path: /checode
70+
# (OPTIONAL) The memory limit of the container
71+
memoryLimit: 256Mi
72+
# (OPTIONAL) The memory request of the container
73+
memoryRequest: 32Mi
74+
# (OPTIONAL) The CPU limit of the container
75+
cpuLimit: 500m
76+
# (OPTIONAL) The CPU request of the container
77+
cpuRequest: 30m
78+
# Name of the component
79+
- name: che-code-runtime-description
80+
# (OPTIONAL) Map of implementation-dependant free-form YAML attributes
81+
attributes:
82+
# The component within the architecture
83+
app.kubernetes.io/component: che-code-runtime
84+
# The name of a higher level application this one is part of
85+
app.kubernetes.io/part-of: che-code.eclipse.org
86+
# Defines a container component as a "container contribution". If a flattened DevWorkspace has a container component with the merge-contribution attribute, then any container contributions are merged into that container component
87+
controller.devfile.io/container-contribution: true
88+
container:
89+
# Can be a dummy image because the component is expected to be injected into workspace dev component
90+
image: quay.io/devfile/universal-developer-image:latest
91+
# (OPTIONAL) List of volume mounts that should be mounted in this container
92+
volumeMounts:
93+
# The name of the mount
94+
- name: checode
95+
# (OPTIONAL) The path in the component container where the volume should be mounted. If no path is defined, the default path is the is /<name>
96+
path: /checode
97+
# (OPTIONAL) The memory limit of the container
98+
memoryLimit: 1024Mi
99+
# (OPTIONAL) The memory request of the container
100+
memoryRequest: 256Mi
101+
# (OPTIONAL) The CPU limit of the container
102+
cpuLimit: 500m
103+
# (OPTIONAL) The CPU request of the container
104+
cpuRequest: 30m
105+
# (OPTIONAL) Environment variables used in this container
106+
env:
107+
- name: ENV_NAME
108+
value: value
109+
# Component endpoints
110+
endpoints:
111+
# Name of the editor
112+
- name: che-code
113+
# (OPTIONAL) Map of implementation-dependant string-based free-form attributes
114+
attributes:
115+
# Type of the endpoint. You can only set its value to main, indicating that the endpoint should be used as the mainUrl in the workspace status (i.e. it should be the URL used to access the editor in this context)
116+
type: main
117+
# An attribute that instructs the service to automatically redirect the unauthenticated requests for current user authentication. Setting this attribute to true has security consequences because it makes Cross-site request forgery (CSRF) attacks possible. The default value of the attribute is false.
118+
cookiesAuthEnabled: true
119+
# Defines an endpoint as "discoverable", meaning that a service should be created using the endpoint name (i.e. instead of generating a service name for all endpoints, this endpoint should be statically accessible)
120+
discoverable: false
121+
# Used to secure the endpoint with authorization on OpenShift, so that not anyone on the cluster can access the endpoint, the attribute enables authentication.
122+
urlRewriteSupported: true
123+
# Port number to be used within the container component
124+
targetPort: 3100
125+
# (OPTIONAL) Describes how the endpoint should be exposed on the network (public, internal, none)
126+
exposure: public
127+
# (OPTIONAL) Describes whether the endpoint should be secured and protected by some authentication process
128+
secure: true
129+
# (OPTIONAL) Describes the application and transport protocols of the traffic that will go through this endpoint
130+
protocol: https
131+
# Mandatory name that allows referencing the component from other elements
132+
- name: checode
133+
# (OPTIONAL) Allows specifying the definition of a volume shared by several other components. Ephemeral volumes are not stored persistently across restarts. Defaults to false
134+
volume: {ephemeral: true}
135+
# (OPTIONAL) Bindings of commands to events. Each command is referred-to by its name
136+
events:
137+
# IDs of commands that should be executed before the devworkspace start. These commands would typically be executed in an init container
138+
preStart:
139+
- init-container-command
140+
# IDs of commands that should be executed after the devworkspace has completely started. In the case of Che-Code, these commands should be executed after all plugins and extensions have started, including project cloning. This means that those commands are not triggered until the user opens the IDE within the browser
141+
postStart:
142+
- init-che-code-command
143+
# (OPTIONAL) Predefined, ready-to-use, devworkspace-related commands
144+
commands:
145+
# Mandatory identifier that allows referencing this command
146+
- id: init-container-command
147+
apply:
148+
# Describes the component for the apply command
149+
component: che-code-injector
150+
# Mandatory identifier that allows referencing this command
151+
- id: init-che-code-command
152+
# CLI Command executed in an existing component container
153+
exec:
154+
# Describes component for the exec command
155+
component: che-code-runtime-description
156+
# The actual command-line string
157+
commandLine: 'nohup /checode/entrypoint-volume.sh > /checode/entrypoint-logs.txt
158+
2>&1 &'
159+
----
160+
161+
. Create a ConfigMap with the editor definition content:
162+
+
163+
[source,shell,subs="+quotes,+attributes"]
164+
----
165+
{orch-cli} create configmap my-editor-definition --from-file=my-editor-definition-devfile.yaml -n {prod-namespace}
166+
----
167+
168+
. Add the required labels to the ConfigMap:
169+
+
170+
[source,shell,subs="+quotes,+attributes"]
171+
----
172+
{orch-cli} label configmap my-editor-definition app.kubernetes.io/part-of=che.eclipse.org app.kubernetes.io/component=editor-definition -n {prod-namespace}
173+
----
174+
175+
. Refresh the {prod-short} Dashboard page to see new available editor.
176+
177+
.Additional resources
178+
179+
* link:https://devfile.io/docs/2.2.2/what-is-a-devfile[Devfile documentation]
180+
181+
* {editor-definition-samples-link}
182+

0 commit comments

Comments
 (0)