Include che.devworkspaces.enabled property (#19193)

* Added che.devworkspaces.enabled property

Signed-off-by: xbaran4 <pbaran@redhat.com>
7.28.x
Pavol Baran 2021-03-04 11:38:53 +01:00 committed by GitHub
parent a01e371268
commit d3f27d2c03
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 21 additions and 2 deletions

View File

@ -158,6 +158,12 @@ che.workspace.startup_debug_log_limit_bytes=10485760
# This configuration is mainly required for workspace idling when the OpenShift OAuth is enabled.
che.workspace.stop.role.enabled=true
# Specifies whether che is deployed with DevWorkspaces enabled.
# This property is set by the Che operator if it also installed the support for DevWorkspaces.
# This property is used to advertise this fact to the Che dashboard.
# It does not make sense to change the value of this property manually.
che.devworkspaces.enabled=false
### Authentication parameters
# Che has a single identity implementation, so this does not change the user experience.

View File

@ -68,6 +68,9 @@ public final class Constants {
public static final String CHE_WORKSPACE_DEVFILE_REGISTRY_INTERNAL_URL_PROPERTY =
"che.workspace.devfile_registry_internal_url";
/** Name for property that specifies whether che is deployed with devworkspaces enabled */
public static final String CHE_DEVWORKSPACES_ENABLED_PROPERTY = "che.devworkspaces.enabled";
public static final String CHE_FACTORY_DEFAULT_EDITOR_PROPERTY = "che.factory.default_editor";
public static final String CHE_FACTORY_DEFAULT_PLUGINS_PROPERTY = "che.factory.default_plugins";

View File

@ -18,6 +18,7 @@ import static javax.ws.rs.core.HttpHeaders.CONTENT_TYPE;
import static javax.ws.rs.core.MediaType.APPLICATION_JSON;
import static org.eclipse.che.api.workspace.server.DtoConverter.asDto;
import static org.eclipse.che.api.workspace.server.WorkspaceKeyValidator.validateKey;
import static org.eclipse.che.api.workspace.shared.Constants.CHE_DEVWORKSPACES_ENABLED_PROPERTY;
import static org.eclipse.che.api.workspace.shared.Constants.CHE_FACTORY_DEFAULT_EDITOR_PROPERTY;
import static org.eclipse.che.api.workspace.shared.Constants.CHE_FACTORY_DEFAULT_PLUGINS_PROPERTY;
import static org.eclipse.che.api.workspace.shared.Constants.CHE_WORKSPACE_AUTO_START;
@ -110,6 +111,7 @@ public class WorkspaceService extends Service {
private final String devfileRegistryInternalUrl;
private final String apiEndpoint;
private final boolean cheWorkspaceAutoStart;
private final boolean cheDevWorkspacesEnabled;
private final FileContentProvider devfileContentProvider;
private final Long logLimitBytes;
private final String availableStorageTypes;
@ -135,7 +137,8 @@ public class WorkspaceService extends Service {
@Named(CHE_WORKSPACE_STORAGE_AVAILABLE_TYPES) String availableStorageTypes,
@Named(CHE_WORKSPACE_STORAGE_PREFERRED_TYPE) String preferredStorageType,
@Named(CHE_FACTORY_DEFAULT_EDITOR_PROPERTY) String defaultEditor,
@Named(CHE_FACTORY_DEFAULT_PLUGINS_PROPERTY) String defaultPlugins) {
@Named(CHE_FACTORY_DEFAULT_PLUGINS_PROPERTY) String defaultPlugins,
@Named(CHE_DEVWORKSPACES_ENABLED_PROPERTY) boolean cheDevWorkspacesEnabled) {
this.apiEndpoint = apiEndpoint;
this.cheWorkspaceAutoStart = cheWorkspaceAutoStart;
this.workspaceManager = workspaceManager;
@ -151,6 +154,7 @@ public class WorkspaceService extends Service {
this.preferredStorageType = preferredStorageType;
this.defaultEditor = defaultEditor;
this.defaultPlugins = defaultPlugins;
this.cheDevWorkspacesEnabled = cheDevWorkspacesEnabled;
}
@Path("/devfile")
@ -464,6 +468,7 @@ public class WorkspaceService extends Service {
settings.put(CHE_FACTORY_DEFAULT_EDITOR_PROPERTY, defaultEditor);
settings.put(CHE_WORKSPACE_STORAGE_AVAILABLE_TYPES, availableStorageTypes);
settings.put(CHE_WORKSPACE_STORAGE_PREFERRED_TYPE, preferredStorageType);
settings.put(CHE_DEVWORKSPACES_ENABLED_PROPERTY, Boolean.toString(cheDevWorkspacesEnabled));
return settings.build();
}

View File

@ -23,6 +23,7 @@ import static org.eclipse.che.api.core.model.workspace.WorkspaceStatus.STOPPED;
import static org.eclipse.che.api.core.model.workspace.config.MachineConfig.MEMORY_LIMIT_ATTRIBUTE;
import static org.eclipse.che.api.core.model.workspace.runtime.MachineStatus.RUNNING;
import static org.eclipse.che.api.workspace.server.DtoConverter.asDto;
import static org.eclipse.che.api.workspace.shared.Constants.CHE_DEVWORKSPACES_ENABLED_PROPERTY;
import static org.eclipse.che.api.workspace.shared.Constants.CHE_FACTORY_DEFAULT_EDITOR_PROPERTY;
import static org.eclipse.che.api.workspace.shared.Constants.CHE_FACTORY_DEFAULT_PLUGINS_PROPERTY;
import static org.eclipse.che.api.workspace.shared.Constants.CHE_WORKSPACE_AUTO_START;
@ -150,6 +151,8 @@ public class WorkspaceServiceTest {
private final String defaultEditor = "theia";
private final String defaultPlugins = "machine-exec";
private static final boolean CHE_DEVWORKSPACES_ENABLED = false;
@SuppressWarnings("unused") // is declared for deploying by everrest-assured
private CheJsonProvider jsonProvider = new CheJsonProvider(Collections.emptySet());
@ -185,7 +188,8 @@ public class WorkspaceServiceTest {
availableStorageTypes,
preferredStorageType,
defaultEditor,
defaultPlugins);
defaultPlugins,
CHE_DEVWORKSPACES_ENABLED);
}
@Test
@ -907,6 +911,7 @@ public class WorkspaceServiceTest {
.put(CHE_WORKSPACE_STORAGE_PREFERRED_TYPE, preferredStorageType)
.put(CHE_FACTORY_DEFAULT_EDITOR_PROPERTY, defaultEditor)
.put(CHE_FACTORY_DEFAULT_PLUGINS_PROPERTY, defaultPlugins)
.put(CHE_DEVWORKSPACES_ENABLED_PROPERTY, Boolean.toString(CHE_DEVWORKSPACES_ENABLED))
.build());
}