From dcbd82a231ba464113eb6166d2e9e97b2d3b3df0 Mon Sep 17 00:00:00 2001 From: Anatolii Bazko Date: Wed, 11 Sep 2024 12:53:00 +0200 Subject: [PATCH] =?UTF-8?q?chore:=20Add=20article=20about=20limiting=20the?= =?UTF-8?q?=20number=20of=20running=20workspaces=20ac=E2=80=A6=20(#2788)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * chore: Add article about limiting the number of running workspaces across the cluster and concealing editors Signed-off-by: Anatolii Bazko Co-authored-by: Jana Vrbkova --- antora.yml | 2 + modules/administration-guide/nav.adoc | 3 + .../pages/concealing-editors-definitions.adoc | 172 ++++++++++++++++++ .../pages/configuring-a-user-namespace.adoc | 2 +- .../pages/configuring-dashboard.adoc | 4 + ...configuring-default-editor-definition.adoc | 45 +++++ .../configuring-editors-definitions.adoc | 4 +- .../configuring-workspaces-globally.adoc | 2 + ...that-all-users-can-run-simultaneously.adoc | 37 ++++ .../pages/devfile-introduction.adoc | 6 +- 10 files changed, 271 insertions(+), 6 deletions(-) create mode 100644 modules/administration-guide/pages/concealing-editors-definitions.adoc create mode 100644 modules/administration-guide/pages/configuring-default-editor-definition.adoc create mode 100644 modules/administration-guide/pages/limiting-the-number-of-workspaces-that-all-users-can-run-simultaneously.adoc diff --git a/antora.yml b/antora.yml index c9b271a1c3..b3aae01e02 100644 --- a/antora.yml +++ b/antora.yml @@ -87,6 +87,7 @@ asciidoc: prod-operator-index: registry.access.redhat.com/redhat/community-operator-index:v{ocp4-ver} prod-operator-package-name: eclipse-che prod-operator: che-operator + prod-operator-subscription: eclipse-che prod-prev-short: Che prod-prev-id-short: che prod-prev-ver: "previous minor version" @@ -109,6 +110,7 @@ asciidoc: rh-os-local: Red Hat OpenShift Local theia-endpoint-image: eclipse/che-theia-endpoint-runtime:next editor-definition-samples-link: link:https://github.com/eclipse-che/che-operator/tree/main/editors-definitions[Editors definitions samples] + devfile-api-version: 2.3.0 ext: collector: - run: diff --git a/modules/administration-guide/nav.adoc b/modules/administration-guide/nav.adoc index bfe40e1bae..8e34d2077a 100644 --- a/modules/administration-guide/nav.adoc +++ b/modules/administration-guide/nav.adoc @@ -42,6 +42,7 @@ *** xref:configuring-machine-autoscaling.adoc[] ** xref:configuring-workspaces-globally.adoc[] *** xref:limiting-the-number-of-workspaces-that-a-user-can-keep.adoc[] +*** xref:limiting-the-number-of-workspaces-that-all-users-can-run-simultaneously.adoc[] *** xref:enabling-users-to-run-multiple-workspaces-simultaneously.adoc[] *** xref:deploying-che-with-support-for-git-repositories-with-self-signed-certificates.adoc[] *** xref:configuring-workspaces-nodeselector.adoc[] @@ -74,6 +75,8 @@ ** xref:configuring-dashboard.adoc[] *** xref:configuring-getting-started-samples.adoc[] *** xref:configuring-editors-definitions.adoc[] +*** xref:configuring-default-editor-definition.adoc[] +*** xref:concealing-editors-definitions.adoc[] *** xref:customizing-openshift-che-consolelink-icon.adoc[] ** xref:managing-identities-and-authorizations.adoc[] *** xref:configuring-oauth-for-git-providers.adoc[] diff --git a/modules/administration-guide/pages/concealing-editors-definitions.adoc b/modules/administration-guide/pages/concealing-editors-definitions.adoc new file mode 100644 index 0000000000..da49fc692a --- /dev/null +++ b/modules/administration-guide/pages/concealing-editors-definitions.adoc @@ -0,0 +1,172 @@ +:_content-type: PROCEDURE +:description: Concealing editors definitions +:keywords: administration guide, concealing, dashboard, editors +:navtitle: Concealing editors definitions + +[id="concealing-editors-definitions"] += Concealing editors definitions + +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. + +.Prerequisites + +* An active `{orch-cli}` session with administrative permissions to the {orch-name} cluster. See {orch-cli-link}. + +* `jq`. See link:https://stedolan.github.io/jq/download/[Downloading `jq`]. + +.Procedure + +. Find out the namespace where the {prod-short} Operator is deployed: ++ +[source,subs="+attributes"] +---- +OPERATOR_NAMESPACE=$({orch-cli} get pods -l app.kubernetes.io/component={prod-operator} -o jsonpath={".items[0].metadata.namespace"} --all-namespaces) +---- + +. Find out the available editors definitions files: ++ +[source,subs="+attributes"] +---- +{orch-cli} exec -n $OPERATOR_NAMESPACE deploy/{prod-operator} -- ls /tmp/editors-definitions +---- +The output should look similar to the following example: ++ +[source] +---- +che-code-insiders.yaml +che-code-latest.yaml +che-idea-latest.yaml +che-idea-next.yaml +---- + +. Choose an editor definition to conceal. +For example, to conceal the `che-idea-next.yaml` editor definition, set the editor definition file name: ++ +[source,subs="+attributes"] +---- +CHE_EDITOR_CONCEAL_FILE_NAME=che-idea-next.yaml +---- + +. Define the ConfigMap name for the concealed editor definition: ++ +[source,subs="+attributes"] +---- +CHE_EDITOR_CONCEAL_CONFIGMAP_NAME=che-conceal-$CHE_EDITOR_CONCEAL_FILE_NAME +---- + +. Create the ConfigMap: ++ +[source,subs="+attributes"] +---- +{orch-cli} create configmap $CHE_EDITOR_CONCEAL_CONFIGMAP_NAME \ + --namespace $OPERATOR_NAMESPACE \ + --from-literal=$CHE_EDITOR_CONCEAL_FILE_NAME="" +---- + +. Find out the Operator subscription namespace (if it exists): ++ +[source,subs="+attributes"] +---- +SUBSCRIPTION_NAMESPACE=$({orch-cli} get subscription \ + --all-namespaces \ + --field-selector=metadata.name={prod-operator-subscription} \ + --output jsonpath='{.items[0].metadata.namespace}' 2>/dev/null +) +---- + +. 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: ++ +[source,subs="+attributes"] +---- +if [[ -n $SUBSCRIPTION_NAMESPACE ]]; then + if [[ $({orch-cli} get subscription {prod-operator-subscription} --namespace $SUBSCRIPTION_NAMESPACE --output jsonpath='{.spec.config}') == "" ]]; then + {orch-cli} patch subscription {prod-operator-subscription} \ + --namespace $SUBSCRIPTION_NAMESPACE \ + --type json \ + --patch '[{ + "op":"add", + "path":"/spec/config", + "value": {} + }]' + fi + + if [[ $({orch-cli} get subscription {prod-operator-subscription} --namespace $SUBSCRIPTION_NAMESPACE --output jsonpath='{.spec.config.volumes}') == "" ]]; then + {orch-cli} patch subscription {prod-operator-subscription} \ + --namespace $SUBSCRIPTION_NAMESPACE \ + --type json \ + --patch '[{ + "op":"add", + "path":"/spec/config/volumes", + "value": [] + }]' + fi + + if [[ $({orch-cli} get subscription {prod-operator-subscription} --namespace $SUBSCRIPTION_NAMESPACE --output jsonpath='{.spec.config.volumeMounts}') == "" ]]; then + {orch-cli} patch subscription {prod-operator-subscription} \ + --namespace $SUBSCRIPTION_NAMESPACE \ + --type json \ + --patch '[{ + "op":"add", + "path":"/spec/config/volumeMounts", + "value": [] + }]' + fi + + {orch-cli} patch subscription {prod-operator-subscription} \ + --namespace $SUBSCRIPTION_NAMESPACE \ + --type json \ + --patch '[{ + "op":"add", + "path":"/spec/config/volumes/-", + "value": { + "name":"'$(echo ${CHE_EDITOR_CONCEAL_FILE_NAME%.*})'", + "configMap": { + "name": "'$CHE_EDITOR_CONCEAL_CONFIGMAP_NAME'" + } + } + }, + { + "op":"add", + "path":"/spec/config/volumeMounts/-", + "value":{ + "name": "'$(echo ${CHE_EDITOR_CONCEAL_FILE_NAME%.*})'", + "subPath":"'$CHE_EDITOR_CONCEAL_FILE_NAME'", + "mountPath": "/tmp/editors-definitions/'$CHE_EDITOR_CONCEAL_FILE_NAME'" + } + }]' +else + {orch-cli} patch deployment {prod-operator} \ + --namespace $OPERATOR_NAMESPACE \ + --type json \ + --patch '[{ + "op":"add", + "path":"/spec/template/spec/volumes/-", + "value": { + "name":"'$(echo ${CHE_EDITOR_CONCEAL_FILE_NAME%.*})'", + "configMap": { + "name": "'$CHE_EDITOR_CONCEAL_CONFIGMAP_NAME'" + } + } + }, + { + "op":"add", + "path":"/spec/template/spec/containers/0/volumeMounts/-", + "value":{ + "name": "'$(echo ${CHE_EDITOR_CONCEAL_FILE_NAME%.*})'", + "subPath":"'$CHE_EDITOR_CONCEAL_FILE_NAME'", + "mountPath": "/tmp/editors-definitions/'$CHE_EDITOR_CONCEAL_FILE_NAME'" + } + } +]' +fi +---- + + +.Additional resources + +* xref:configuring-editors-definitions.adoc[] + +* xref:configuring-default-editor-definition.adoc[] + +* {editor-definition-samples-link} + diff --git a/modules/administration-guide/pages/configuring-a-user-namespace.adoc b/modules/administration-guide/pages/configuring-a-user-namespace.adoc index a535baa616..7a6e79f565 100644 --- a/modules/administration-guide/pages/configuring-a-user-namespace.adoc +++ b/modules/administration-guide/pages/configuring-a-user-namespace.adoc @@ -103,7 +103,7 @@ stringData: ---- NOTE: Run `update-ca-trust` command on workspace startup to import certificates. It can be achieved manually or by adding this command to a `postStart` event in a devfile. -See the link:https://devfile.io/docs/2.2.2/adding-event-bindings#post-start-object[Adding event bindings in a devfile]. +See the link:https://devfile.io/docs/{devfile-api-version}/adding-event-bindings#post-start-object[Adding event bindings in a devfile]. ==== + .Mounting environment variables to a user workspace: diff --git a/modules/administration-guide/pages/configuring-dashboard.adoc b/modules/administration-guide/pages/configuring-dashboard.adoc index 4501089ebe..766a19bc75 100644 --- a/modules/administration-guide/pages/configuring-dashboard.adoc +++ b/modules/administration-guide/pages/configuring-dashboard.adoc @@ -11,5 +11,9 @@ * xref:configuring-editors-definitions.adoc[] +* xref:configuring-default-editor-definition.adoc[] + +* xref:concealing-editors-definitions.adoc[] + * xref:customizing-openshift-che-consolelink-icon.adoc[] diff --git a/modules/administration-guide/pages/configuring-default-editor-definition.adoc b/modules/administration-guide/pages/configuring-default-editor-definition.adoc new file mode 100644 index 0000000000..e12ac79991 --- /dev/null +++ b/modules/administration-guide/pages/configuring-default-editor-definition.adoc @@ -0,0 +1,45 @@ +:_content-type: PROCEDURE +:description: Configuring default editor +:keywords: administration guide, dashboard, editors +:navtitle: Configuring default editor definition + +[id="configuring-default-editor-definition"] += Configuring default editor definition + +Learn how to configure {prod-short} default editor definition. + +.Prerequisites + +* An active `{orch-cli}` session with administrative permissions to the {orch-name} cluster. See {orch-cli-link}. + +* `jq`. See link:https://stedolan.github.io/jq/download/[Downloading `jq`]. + +.Procedure + +. Find out the IDs of the available editors: ++ +[source,subs="+quotes,+attributes"] +---- +{orch-cli} exec deploy/{prod-id-short}-dashboard -n {prod-namespace} \ + -- curl -s http://localhost:8080/dashboard/api/editors | jq -r '.[] | "\(.metadata.attributes.publisher)/\(.metadata.name)/\(.metadata.attributes.version)"' +---- + +. Configure the `defaultEditor`: ++ +[source,subs="+quotes,+attributes"] +---- +{orch-cli} patch checluster/{prod-checluster} \ + --namespace {prod-namespace} \ + --type='merge' \ + -p '{"spec":{"devEnvironments":{"defaultEditor": "____"}}}'# <1> +---- +<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. + +.Additional resources + +* xref:configuring-editors-definitions.adoc[] + +* xref:concealing-editors-definitions.adoc[] + +* {editor-definition-samples-link} + diff --git a/modules/administration-guide/pages/configuring-editors-definitions.adoc b/modules/administration-guide/pages/configuring-editors-definitions.adoc index 5b7769fa74..bf4121fc8b 100644 --- a/modules/administration-guide/pages/configuring-editors-definitions.adoc +++ b/modules/administration-guide/pages/configuring-editors-definitions.adoc @@ -179,13 +179,13 @@ commands: The editor definition is also served by the {prod-short} dashboard API from the following URL: -`pass:c,a,q[{prod-url}]/dashboard/api/editors/devfile?che-editor=____` +`pass:c,a,q[{prod-url}]/dashboard/api/editors` For the example from xref:configuring-editors-definitions.adoc[], the editor definition can be retrieved by accessing the following URL: `pass:c,a,q[{prod-url}]/dashboard/api/editors/devfile?che-editor=publisher/editor-name/version` -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=____` +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` .Additional resources diff --git a/modules/administration-guide/pages/configuring-workspaces-globally.adoc b/modules/administration-guide/pages/configuring-workspaces-globally.adoc index f0f106ca01..fcb760898d 100644 --- a/modules/administration-guide/pages/configuring-workspaces-globally.adoc +++ b/modules/administration-guide/pages/configuring-workspaces-globally.adoc @@ -11,6 +11,8 @@ This section describes how an administrator can configure workspaces globally. * xref:limiting-the-number-of-workspaces-that-a-user-can-keep.adoc[] +* xref:limiting-the-number-of-workspaces-that-all-users-can-run-simultaneously.adoc[] + * xref:enabling-users-to-run-multiple-workspaces-simultaneously.adoc[] * xref:deploying-che-with-support-for-git-repositories-with-self-signed-certificates.adoc[] diff --git a/modules/administration-guide/pages/limiting-the-number-of-workspaces-that-all-users-can-run-simultaneously.adoc b/modules/administration-guide/pages/limiting-the-number-of-workspaces-that-all-users-can-run-simultaneously.adoc new file mode 100644 index 0000000000..5367744706 --- /dev/null +++ b/modules/administration-guide/pages/limiting-the-number-of-workspaces-that-all-users-can-run-simultaneously.adoc @@ -0,0 +1,37 @@ +:_content-type: PROCEDURE +:description: Limiting the number of workspaces that all users can run simultaneously +:keywords: administration guide, number, workspaces +:navtitle: Limiting the number of workspaces that all users can run simultaneously +:page-aliases: + +[id="limiting-the-number-of-workspaces-that-all-users-can-run-simultaneously"] += Limiting the number of workspaces that all users can run simultaneously + +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: + +[source,yaml,subs="+quotes"] +---- +spec: + devEnvironments: + maxNumberOfRunningWorkspacesPerCluster: ____#<1> + +---- +<1> The maximum number of concurrently running workspaces across the entire Kubernetes cluster. +This applies to all users in the system. If the value is set to -1, it means there is +no limit on the number of running workspaces. + +.Procedure + +. Configure the `maxNumberOfRunningWorkspacesPerCluster`: ++ +[source,subs="+quotes,attributes"] +---- +{orch-cli} patch checluster/{prod-checluster} -n {prod-namespace} \ +--type='merge' -p \ +'{"spec":{"devEnvironments":{"maxNumberOfRunningWorkspacesPerCluster": ____}}}'# <1> +---- +<1> Your choice of the `____` value. + +.Additional resources + +* xref:using-the-cli-to-configure-the-checluster-custom-resource.adoc[] diff --git a/modules/end-user-guide/pages/devfile-introduction.adoc b/modules/end-user-guide/pages/devfile-introduction.adoc index fb0f062728..f1b2d2117c 100644 --- a/modules/end-user-guide/pages/devfile-introduction.adoc +++ b/modules/end-user-guide/pages/devfile-introduction.adoc @@ -26,8 +26,8 @@ link:https://registry.devfile.io/viewer[Devfile Registry] contains ready-to-use .Additional resources -* link:https://devfile.io/docs/2.2.2/what-is-a-devfile[What is a devfile] -* link:https://devfile.io/docs/2.2.0/benefits-of-devfile[Benefits of devfile] -* link:https://devfile.io/docs/2.2.2/overview[Devfile customization overview] +* link:https://devfile.io/docs/{devfile-api-version}/what-is-a-devfile[What is a devfile] +* link:https://devfile.io/docs/{devfile-api-version}/benefits-of-devfile[Benefits of devfile] +* link:https://devfile.io/docs/{devfile-api-version}/overview[Devfile customization overview] * link:https://devfile.io/[Devfile.io] * link:https://che.eclipseprojects.io/2024/02/05/@mario.loriedo-cde-customization.html[Customizing Cloud Development Environments]