Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🚧 Propagate default ephemeral mode value #15713

Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ public class WorkspaceService extends Service {
private final String apiEndpoint;
private final boolean cheWorkspaceAutoStart;
private final FileContentProvider devfileContentProvider;
private final boolean defaultPersistVolumes;

@Inject
public WorkspaceService(
Expand All @@ -117,6 +118,7 @@ public WorkspaceService(
WorkspaceLinksGenerator linksGenerator,
@Named(CHE_WORKSPACE_PLUGIN_REGISTRY_URL_PROPERTY) @Nullable String pluginRegistryUrl,
@Named(CHE_WORKSPACE_DEVFILE_REGISTRY_URL_PROPERTY) @Nullable String devfileRegistryUrl,
@Named("che.infra.kubernetes.pvc.enabled") boolean defaultPersistVolumes,
sleshchenko marked this conversation as resolved.
Show resolved Hide resolved
sleshchenko marked this conversation as resolved.
Show resolved Hide resolved
URLFetcher urlFetcher) {
this.apiEndpoint = apiEndpoint;
this.cheWorkspaceAutoStart = cheWorkspaceAutoStart;
Expand All @@ -126,6 +128,7 @@ public WorkspaceService(
this.pluginRegistryUrl = pluginRegistryUrl;
this.devfileRegistryUrl = devfileRegistryUrl;
this.devfileContentProvider = new URLFileContentProvider(null, urlFetcher);
this.defaultPersistVolumes = defaultPersistVolumes;
}

@POST
Expand Down Expand Up @@ -829,6 +832,8 @@ public Map<String, String> getSettings() {
settings.put("cheWorkspaceDevfileRegistryUrl", devfileRegistryUrl);
}

settings.put("cheWorkspacesDefaultPersistVolumes", Boolean.toString(defaultPersistVolumes));

return settings.build();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,8 @@ public class WorkspaceServiceTest {
private static final String CHE_WORKSPACE_PLUGIN_REGISTRY_ULR = "http://localhost:9898/plugins/";
private static final String CHE_WORKSPACE_DEVFILE_REGISTRY_ULR =
"http://localhost:9898/devfiles/";
private static final boolean CHE_WORKSPACES_DEFAULT_PERSIST_VOLUMES = false;

private static final Account TEST_ACCOUNT = new AccountImpl("anyId", NAMESPACE, "test");

@SuppressWarnings("unused")
Expand All @@ -149,6 +151,7 @@ public void setup() {
linksGenerator,
CHE_WORKSPACE_PLUGIN_REGISTRY_ULR,
CHE_WORKSPACE_DEVFILE_REGISTRY_ULR,
CHE_WORKSPACES_DEFAULT_PERSIST_VOLUMES,
urlFetcher);
}

Expand Down Expand Up @@ -1327,7 +1330,9 @@ public void shouldBeAbleToGetSettings() throws Exception {
"cheWorkspacePluginRegistryUrl",
CHE_WORKSPACE_PLUGIN_REGISTRY_ULR,
"cheWorkspaceDevfileRegistryUrl",
CHE_WORKSPACE_DEVFILE_REGISTRY_ULR));
CHE_WORKSPACE_DEVFILE_REGISTRY_ULR,
"cheWorkspacesDefaultPersistVolumes",
Boolean.toString(CHE_WORKSPACES_DEFAULT_PERSIST_VOLUMES)));
}

private static String unwrapError(Response response) {
Expand Down