Limit the number of workspaces that a user can keep

By default, users can keep an unlimited number of workspaces in the dashboard, but you can limit this number to reduce demand on the cluster.

Prerequisites
  • An active kubectl session with administrative permissions to the destination Kubernetes cluster. See Overview of kubectl.

This configuration is part of the CheCluster Custom Resource:

spec:
  devEnvironments:
    maxNumberOfWorkspacesPerUser: <kept_workspaces_limit>(1)
1 Sets the maximum number of workspaces per user. The default value, -1, allows users to keep an unlimited number of workspaces. Use a positive integer to set the maximum number of workspaces per user.
Procedure
  1. Get the name of the Che namespace. The default is eclipse-che.

    $ kubectl get checluster --all-namespaces \
      -o=jsonpath="{.items[*].metadata.namespace}"
  2. Configure the maxNumberOfWorkspacesPerUser:

    $ kubectl patch checluster/che -n eclipse-che \(1)
    --type='merge' -p \
    '{"spec":{"devEnvironments":{"maxNumberOfWorkspacesPerUser": <kept_workspaces_limit>}}}'(2)
    1 The Che namespace that you got in step 1.
    2 Your choice of the <kept_workspaces_limit> value.