Ensure home persistence can only be enabled when workspace requires persistent storage #1241
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What does this PR do?
This PR makes 2 changes:
Ensure only the storage strategies which support home persistence result in the persistent home devfile volume being added to a devworkspace.
The storage strategies which support home persistence are: per-user/common, perworkspace & async. The ephemeral storage strategy does not support home persistence.
Previously, we were trying to disable home persistence for the ephemeral storage strategy by calling
provisioner.NeedsStorage()
, however, the implementation of this function for the per-workspace PVC strategy always returns false and thus disabled home persistence when using per-workspace storage.Now, we simply disable home persistence if the devworkspace is using the ephemeral storage strategy.
Ensure home persistence is only enabled for workspaces which actually require persistent storage.
There are cases where a devworkspace could use the per-workspace, per-user or async storage strategy, but not actually require persistent storage. For example, a devworkspace with no volume components and no components which mount project sources. In these cases, we should not add a persistent home devfile volume to the devworkspace.
What issues does this PR fix or reference?
Fix #1238
Is it tested? How?
Test the per-workspace storage strategy can be used with persistUserHome
config.workspace.persistUserHome: true
in the DWOC:kubectl edit dwoc -n $NAMESPACE
Ensure persistent home volumeMount is not created when the workspace does not need storage
config.workspace.persistUserHome: true
in the DWOC:kubectl edit dwoc -n $NAMESPACE
mountSources: true
. For example:/home/user/
:PR Checklist
/test v8-devworkspace-operator-e2e, v8-che-happy-path
to trigger)v8-devworkspace-operator-e2e
: DevWorkspace e2e testv8-che-happy-path
: Happy path for verification integration with Che