Skip to content

Commit dcbd82a

Browse files
chore: Add article about limiting the number of running workspaces ac… (#2788)
* chore: Add article about limiting the number of running workspaces across the cluster and concealing editors Signed-off-by: Anatolii Bazko <abazko@redhat.com> Co-authored-by: Jana Vrbkova <jvrbkova@redhat.com>
1 parent 186138a commit dcbd82a

10 files changed

+271
-6
lines changed

antora.yml

+2
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ asciidoc:
8787
prod-operator-index: registry.access.redhat.com/redhat/community-operator-index:v{ocp4-ver}
8888
prod-operator-package-name: eclipse-che
8989
prod-operator: che-operator
90+
prod-operator-subscription: eclipse-che
9091
prod-prev-short: Che
9192
prod-prev-id-short: che
9293
prod-prev-ver: "previous minor version"
@@ -109,6 +110,7 @@ asciidoc:
109110
rh-os-local: Red Hat OpenShift Local
110111
theia-endpoint-image: eclipse/che-theia-endpoint-runtime:next
111112
editor-definition-samples-link: link:https://github.com/eclipse-che/che-operator/tree/main/editors-definitions[Editors definitions samples]
113+
devfile-api-version: 2.3.0
112114
ext:
113115
collector:
114116
- run:

modules/administration-guide/nav.adoc

+3
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@
4242
*** xref:configuring-machine-autoscaling.adoc[]
4343
** xref:configuring-workspaces-globally.adoc[]
4444
*** xref:limiting-the-number-of-workspaces-that-a-user-can-keep.adoc[]
45+
*** xref:limiting-the-number-of-workspaces-that-all-users-can-run-simultaneously.adoc[]
4546
*** xref:enabling-users-to-run-multiple-workspaces-simultaneously.adoc[]
4647
*** xref:deploying-che-with-support-for-git-repositories-with-self-signed-certificates.adoc[]
4748
*** xref:configuring-workspaces-nodeselector.adoc[]
@@ -74,6 +75,8 @@
7475
** xref:configuring-dashboard.adoc[]
7576
*** xref:configuring-getting-started-samples.adoc[]
7677
*** xref:configuring-editors-definitions.adoc[]
78+
*** xref:configuring-default-editor-definition.adoc[]
79+
*** xref:concealing-editors-definitions.adoc[]
7780
*** xref:customizing-openshift-che-consolelink-icon.adoc[]
7881
** xref:managing-identities-and-authorizations.adoc[]
7982
*** xref:configuring-oauth-for-git-providers.adoc[]
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,172 @@
1+
:_content-type: PROCEDURE
2+
:description: Concealing editors definitions
3+
:keywords: administration guide, concealing, dashboard, editors
4+
:navtitle: Concealing editors definitions
5+
6+
[id="concealing-editors-definitions"]
7+
= Concealing editors definitions
8+
9+
Learn how to conceal {prod-short} editor definitions. This is useful when you want to hide selected editors from the Dashboard UI, e.g. hide the IntelliJ IDEA Ultimate and have only Visual Studio Code - Open Source visible.
10+
11+
.Prerequisites
12+
13+
* An active `{orch-cli}` session with administrative permissions to the {orch-name} cluster. See {orch-cli-link}.
14+
15+
* `jq`. See link:https://stedolan.github.io/jq/download/[Downloading `jq`].
16+
17+
.Procedure
18+
19+
. Find out the namespace where the {prod-short} Operator is deployed:
20+
+
21+
[source,subs="+attributes"]
22+
----
23+
OPERATOR_NAMESPACE=$({orch-cli} get pods -l app.kubernetes.io/component={prod-operator} -o jsonpath={".items[0].metadata.namespace"} --all-namespaces)
24+
----
25+
26+
. Find out the available editors definitions files:
27+
+
28+
[source,subs="+attributes"]
29+
----
30+
{orch-cli} exec -n $OPERATOR_NAMESPACE deploy/{prod-operator} -- ls /tmp/editors-definitions
31+
----
32+
The output should look similar to the following example:
33+
+
34+
[source]
35+
----
36+
che-code-insiders.yaml
37+
che-code-latest.yaml
38+
che-idea-latest.yaml
39+
che-idea-next.yaml
40+
----
41+
42+
. Choose an editor definition to conceal.
43+
For example, to conceal the `che-idea-next.yaml` editor definition, set the editor definition file name:
44+
+
45+
[source,subs="+attributes"]
46+
----
47+
CHE_EDITOR_CONCEAL_FILE_NAME=che-idea-next.yaml
48+
----
49+
50+
. Define the ConfigMap name for the concealed editor definition:
51+
+
52+
[source,subs="+attributes"]
53+
----
54+
CHE_EDITOR_CONCEAL_CONFIGMAP_NAME=che-conceal-$CHE_EDITOR_CONCEAL_FILE_NAME
55+
----
56+
57+
. Create the ConfigMap:
58+
+
59+
[source,subs="+attributes"]
60+
----
61+
{orch-cli} create configmap $CHE_EDITOR_CONCEAL_CONFIGMAP_NAME \
62+
--namespace $OPERATOR_NAMESPACE \
63+
--from-literal=$CHE_EDITOR_CONCEAL_FILE_NAME=""
64+
----
65+
66+
. Find out the Operator subscription namespace (if it exists):
67+
+
68+
[source,subs="+attributes"]
69+
----
70+
SUBSCRIPTION_NAMESPACE=$({orch-cli} get subscription \
71+
--all-namespaces \
72+
--field-selector=metadata.name={prod-operator-subscription} \
73+
--output jsonpath='{.items[0].metadata.namespace}' 2>/dev/null
74+
)
75+
----
76+
77+
. Patch the {kubernetes} resource to mount the ConfigMap with the empty editor definition. The resource to patch depends on the existence of the Operator subscription. If the subscription exists, then the subscription should be patched. If not, patch the Operator deployment:
78+
+
79+
[source,subs="+attributes"]
80+
----
81+
if [[ -n $SUBSCRIPTION_NAMESPACE ]]; then
82+
if [[ $({orch-cli} get subscription {prod-operator-subscription} --namespace $SUBSCRIPTION_NAMESPACE --output jsonpath='{.spec.config}') == "" ]]; then
83+
{orch-cli} patch subscription {prod-operator-subscription} \
84+
--namespace $SUBSCRIPTION_NAMESPACE \
85+
--type json \
86+
--patch '[{
87+
"op":"add",
88+
"path":"/spec/config",
89+
"value": {}
90+
}]'
91+
fi
92+
93+
if [[ $({orch-cli} get subscription {prod-operator-subscription} --namespace $SUBSCRIPTION_NAMESPACE --output jsonpath='{.spec.config.volumes}') == "" ]]; then
94+
{orch-cli} patch subscription {prod-operator-subscription} \
95+
--namespace $SUBSCRIPTION_NAMESPACE \
96+
--type json \
97+
--patch '[{
98+
"op":"add",
99+
"path":"/spec/config/volumes",
100+
"value": []
101+
}]'
102+
fi
103+
104+
if [[ $({orch-cli} get subscription {prod-operator-subscription} --namespace $SUBSCRIPTION_NAMESPACE --output jsonpath='{.spec.config.volumeMounts}') == "" ]]; then
105+
{orch-cli} patch subscription {prod-operator-subscription} \
106+
--namespace $SUBSCRIPTION_NAMESPACE \
107+
--type json \
108+
--patch '[{
109+
"op":"add",
110+
"path":"/spec/config/volumeMounts",
111+
"value": []
112+
}]'
113+
fi
114+
115+
{orch-cli} patch subscription {prod-operator-subscription} \
116+
--namespace $SUBSCRIPTION_NAMESPACE \
117+
--type json \
118+
--patch '[{
119+
"op":"add",
120+
"path":"/spec/config/volumes/-",
121+
"value": {
122+
"name":"'$(echo ${CHE_EDITOR_CONCEAL_FILE_NAME%.*})'",
123+
"configMap": {
124+
"name": "'$CHE_EDITOR_CONCEAL_CONFIGMAP_NAME'"
125+
}
126+
}
127+
},
128+
{
129+
"op":"add",
130+
"path":"/spec/config/volumeMounts/-",
131+
"value":{
132+
"name": "'$(echo ${CHE_EDITOR_CONCEAL_FILE_NAME%.*})'",
133+
"subPath":"'$CHE_EDITOR_CONCEAL_FILE_NAME'",
134+
"mountPath": "/tmp/editors-definitions/'$CHE_EDITOR_CONCEAL_FILE_NAME'"
135+
}
136+
}]'
137+
else
138+
{orch-cli} patch deployment {prod-operator} \
139+
--namespace $OPERATOR_NAMESPACE \
140+
--type json \
141+
--patch '[{
142+
"op":"add",
143+
"path":"/spec/template/spec/volumes/-",
144+
"value": {
145+
"name":"'$(echo ${CHE_EDITOR_CONCEAL_FILE_NAME%.*})'",
146+
"configMap": {
147+
"name": "'$CHE_EDITOR_CONCEAL_CONFIGMAP_NAME'"
148+
}
149+
}
150+
},
151+
{
152+
"op":"add",
153+
"path":"/spec/template/spec/containers/0/volumeMounts/-",
154+
"value":{
155+
"name": "'$(echo ${CHE_EDITOR_CONCEAL_FILE_NAME%.*})'",
156+
"subPath":"'$CHE_EDITOR_CONCEAL_FILE_NAME'",
157+
"mountPath": "/tmp/editors-definitions/'$CHE_EDITOR_CONCEAL_FILE_NAME'"
158+
}
159+
}
160+
]'
161+
fi
162+
----
163+
164+
165+
.Additional resources
166+
167+
* xref:configuring-editors-definitions.adoc[]
168+
169+
* xref:configuring-default-editor-definition.adoc[]
170+
171+
* {editor-definition-samples-link}
172+

modules/administration-guide/pages/configuring-a-user-namespace.adoc

+1-1
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ stringData:
103103
----
104104
NOTE: Run `update-ca-trust` command on workspace startup to import certificates.
105105
It can be achieved manually or by adding this command to a `postStart` event in a devfile.
106-
See the link:https://devfile.io/docs/2.2.2/adding-event-bindings#post-start-object[Adding event bindings in a devfile].
106+
See the link:https://devfile.io/docs/{devfile-api-version}/adding-event-bindings#post-start-object[Adding event bindings in a devfile].
107107
====
108108
+
109109
.Mounting environment variables to a user workspace:

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

+4
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,9 @@
1111

1212
* xref:configuring-editors-definitions.adoc[]
1313

14+
* xref:configuring-default-editor-definition.adoc[]
15+
16+
* xref:concealing-editors-definitions.adoc[]
17+
1418
* xref:customizing-openshift-che-consolelink-icon.adoc[]
1519

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
:_content-type: PROCEDURE
2+
:description: Configuring default editor
3+
:keywords: administration guide, dashboard, editors
4+
:navtitle: Configuring default editor definition
5+
6+
[id="configuring-default-editor-definition"]
7+
= Configuring default editor definition
8+
9+
Learn how to configure {prod-short} default editor definition.
10+
11+
.Prerequisites
12+
13+
* An active `{orch-cli}` session with administrative permissions to the {orch-name} cluster. See {orch-cli-link}.
14+
15+
* `jq`. See link:https://stedolan.github.io/jq/download/[Downloading `jq`].
16+
17+
.Procedure
18+
19+
. Find out the IDs of the available editors:
20+
+
21+
[source,subs="+quotes,+attributes"]
22+
----
23+
{orch-cli} exec deploy/{prod-id-short}-dashboard -n {prod-namespace} \
24+
-- curl -s http://localhost:8080/dashboard/api/editors | jq -r '.[] | "\(.metadata.attributes.publisher)/\(.metadata.name)/\(.metadata.attributes.version)"'
25+
----
26+
27+
. Configure the `defaultEditor`:
28+
+
29+
[source,subs="+quotes,+attributes"]
30+
----
31+
{orch-cli} patch checluster/{prod-checluster} \
32+
--namespace {prod-namespace} \
33+
--type='merge' \
34+
-p '{"spec":{"devEnvironments":{"defaultEditor": "__<default_editor>__"}}}'# <1>
35+
----
36+
<1> The default editor for creating a workspace can be specified using either a plugin ID or a URI. The plugin ID should follow the format: `publisher/name/version`. See available editors IDs in the first step.
37+
38+
.Additional resources
39+
40+
* xref:configuring-editors-definitions.adoc[]
41+
42+
* xref:concealing-editors-definitions.adoc[]
43+
44+
* {editor-definition-samples-link}
45+

modules/administration-guide/pages/configuring-editors-definitions.adoc

+2-2
Original file line numberDiff line numberDiff line change
@@ -179,13 +179,13 @@ commands:
179179

180180
The editor definition is also served by the {prod-short} dashboard API from the following URL:
181181

182-
`pass:c,a,q[{prod-url}]/dashboard/api/editors/devfile?che-editor=__<editor id>__`
182+
`pass:c,a,q[{prod-url}]/dashboard/api/editors`
183183

184184
For the example from xref:configuring-editors-definitions.adoc[], the editor definition can be retrieved by accessing the following URL:
185185

186186
`pass:c,a,q[{prod-url}]/dashboard/api/editors/devfile?che-editor=publisher/editor-name/version`
187187

188-
TIP: When retrieving the editor definition from within the {orch-name} cluster, the {prod-short} dashboard API can be accessed via the dashboard service: `pass:c,a,q[http://{prod-id-short}-dashboard.{prod-namespace}.svc.cluster.local:8080]/dashboard/api/editors/devfile?che-editor=__<editor id>__`
188+
TIP: When retrieving the editor definition from within the {orch-name} cluster, the {prod-short} dashboard API can be accessed via the dashboard service: `pass:c,a,q[http://{prod-id-short}-dashboard.{prod-namespace}.svc.cluster.local:8080]/dashboard/api/editors`
189189

190190
.Additional resources
191191

modules/administration-guide/pages/configuring-workspaces-globally.adoc

+2
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ This section describes how an administrator can configure workspaces globally.
1111

1212
* xref:limiting-the-number-of-workspaces-that-a-user-can-keep.adoc[]
1313

14+
* xref:limiting-the-number-of-workspaces-that-all-users-can-run-simultaneously.adoc[]
15+
1416
* xref:enabling-users-to-run-multiple-workspaces-simultaneously.adoc[]
1517

1618
* xref:deploying-che-with-support-for-git-repositories-with-self-signed-certificates.adoc[]
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
:_content-type: PROCEDURE
2+
:description: Limiting the number of workspaces that all users can run simultaneously
3+
:keywords: administration guide, number, workspaces
4+
:navtitle: Limiting the number of workspaces that all users can run simultaneously
5+
:page-aliases:
6+
7+
[id="limiting-the-number-of-workspaces-that-all-users-can-run-simultaneously"]
8+
= Limiting the number of workspaces that all users can run simultaneously
9+
10+
By default, all users can run unlimited number of workspaces. You can limit the number of workspaces that all users can run simultaneously. This configuration is part of the `CheCluster` Custom Resource:
11+
12+
[source,yaml,subs="+quotes"]
13+
----
14+
spec:
15+
devEnvironments:
16+
maxNumberOfRunningWorkspacesPerCluster: __<running_workspaces_limit>__#<1>
17+
18+
----
19+
<1> The maximum number of concurrently running workspaces across the entire Kubernetes cluster.
20+
This applies to all users in the system. If the value is set to -1, it means there is
21+
no limit on the number of running workspaces.
22+
23+
.Procedure
24+
25+
. Configure the `maxNumberOfRunningWorkspacesPerCluster`:
26+
+
27+
[source,subs="+quotes,attributes"]
28+
----
29+
{orch-cli} patch checluster/{prod-checluster} -n {prod-namespace} \
30+
--type='merge' -p \
31+
'{"spec":{"devEnvironments":{"maxNumberOfRunningWorkspacesPerCluster": __<running_workspaces_limit>__}}}'# <1>
32+
----
33+
<1> Your choice of the `__<running_workspaces_limit>__` value.
34+
35+
.Additional resources
36+
37+
* xref:using-the-cli-to-configure-the-checluster-custom-resource.adoc[]

modules/end-user-guide/pages/devfile-introduction.adoc

+3-3
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@ link:https://registry.devfile.io/viewer[Devfile Registry] contains ready-to-use
2626

2727
.Additional resources
2828

29-
* link:https://devfile.io/docs/2.2.2/what-is-a-devfile[What is a devfile]
30-
* link:https://devfile.io/docs/2.2.0/benefits-of-devfile[Benefits of devfile]
31-
* link:https://devfile.io/docs/2.2.2/overview[Devfile customization overview]
29+
* link:https://devfile.io/docs/{devfile-api-version}/what-is-a-devfile[What is a devfile]
30+
* link:https://devfile.io/docs/{devfile-api-version}/benefits-of-devfile[Benefits of devfile]
31+
* link:https://devfile.io/docs/{devfile-api-version}/overview[Devfile customization overview]
3232
* link:https://devfile.io/[Devfile.io]
3333
* link:https://che.eclipseprojects.io/2024/02/05/@mario.loriedo-cde-customization.html[Customizing Cloud Development Environments]

0 commit comments

Comments
 (0)