-
Notifications
You must be signed in to change notification settings - Fork 72
fix(home): skip persistent home init container for ephemeral workspaces #1651
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -417,6 +417,11 @@ func (r *DevWorkspaceReconciler) Reconcile(ctx context.Context, req ctrl.Request | |
| reqLogger.Info("Skipping init-persistent-home container: persistent home is disabled") | ||
| continue | ||
| } | ||
| // Skip if workspace does not need persistent home (e.g. ephemeral storage) | ||
| if !home.NeedsPersistentHomeDirectory(workspace) { | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Minor note - redundant check
This is harmless - the function is cheap and the double-check doesn't affect correctness. The current approach preserves distinct log messages for each skip reason, which aids debugging. Not a defect, just worth noting for future maintainers. |
||
| reqLogger.Info("Skipping init-persistent-home container: workspace does not need persistent home directory") | ||
| continue | ||
| } | ||
| // Skip if init container is explicitly disabled | ||
| if disableHomeInit { | ||
| reqLogger.Info("Skipping init-persistent-home container: DisableInitContainer is true") | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add test coverage for ephemeral storage case
The PR description marks testing as "TODO". This is a bug fix in the main reconciliation loop - the exact kind of change that benefits most from a unit test proving ephemeral workspaces skip the init container.
The existing
pkg/library/home/persistentHome_test.gotestsNeedsPersistentHomeDirectoryitself, but there's no test verifying the controller's filtering logic applies it correctly. More importantly, none of the 10 test fixtures intestdata/persistent-home/test the ephemeral storage branch (storageStrategySupportsPersistentHomereturning false).Recommendation: Add a test fixture like
noop-if-ephemeral-storage.yamltopkg/library/home/testdata/persistent-home/with:controller.devfile.io/storage-type: ephemeralin its attributesThis is low-effort (YAML file only) and closes the only real coverage gap.