-
Notifications
You must be signed in to change notification settings - Fork 243
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
Display a warning that "odo dev" on Podman needs to be restarted if the Devfile is changed #6477
Conversation
… when local changes are detected The initial idea was to display such a warning only when changes are detected in the Devfile, which are not yet handled completely at this time. But to take into account the manual synchronization case (where there is no file watcher (and therefore no way to determine which files have actually been modified)), a generic warning is being displayed whenever the Podman-specific watch handler is called.
✅ Deploy Preview for odo-docusaurus-preview ready!
To edit notification comments on pull requests, go to your Netlify site settings. |
pkg/dev/podmandev/podmandev.go
Outdated
@@ -167,5 +168,8 @@ func (o *DevClient) watchHandler(ctx context.Context, pushParams adapters.PushPa | |||
WatchFiles: watchParams.WatchFiles, | |||
Variables: watchParams.Variables, | |||
} | |||
|
|||
fmt.Fprintln(watchParams.Out) | |||
log.Fwarning(watchParams.Out, "Changes to the Devfile not supported yet on Podman. Please restart 'odo dev' for such changes to be applied.\n") |
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.
This will be displayed every time, even if the user only modifies sources files.
I would instead add an else
part to the if equality.Semantic.DeepEqual(o.deployedPod, pod)
condition (in the reconcile.go file), and print the warning there
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.
Ah yes, thanks for the pointer. Initially, I had changed the part that looks for changes in the Devfile watcher (in watch.go), but then I had an issue when manually sync'ing with --no-watch
.
This looks like a better approach. I'll make the change - thanks.
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.
One thing I just noticed: if we display the warning as part of if !equality.Semantic.DeepEqual(o.deployedPod, pod)
, the problem is that this would work only if the changes in the Devfile affect the resulting Pod spec.
I noticed that if I only change for example the run
command in the Devfile, the resulting Pod spec is still semantically the same as the previous one, so no warning is displayed. But, the changes were not taken into account (I think because we are still using the same Devfile Object from the context).
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.
I am thinking of just re-parsing the Devfile when the watch handler is called and comparing it to the currently loaded one. And display the warning if there are any differences.
@feloy What do you think?
The Kubedev implementation actually re-parses the Devfile when the watch handler is called:
odo/pkg/dev/kubedev/kubedev.go
Lines 156 to 160 in 020009b
func (o *DevClient) regenerateComponentAdapterFromWatchParams(parameters watch.WatchParameters) (component.ComponentAdapter, error) { | |
devObj, err := devfile.ParseAndValidateFromFileWithVariables(location.DevfileLocation(""), parameters.Variables) | |
if err != nil { | |
return nil, err | |
} |
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.
Yes, that's a good solution IMO
…started when local changes are detected Display a warning that "odo dev" on Podman might need to be restarted when the Devfile is modified
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.
Also, could you add a test to check that no warning is displayed when the Devfile is not changed?
As the code to read the original and new Devfiles is not in the same place, I'm afraid it could drift over time
Kudos, SonarCloud Quality Gate passed! 0 Bugs No Coverage information |
/override OpenShift-Integration-tests/OpenShift-Integration-tests |
@feloy: Overrode contexts on behalf of feloy: OpenShift-Integration-tests/OpenShift-Integration-tests In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
What type of PR is this:
/area odo-on-podman
What does this PR do / why we need it:
Which issue(s) this PR fixes:
Fixes #6336
PR acceptance criteria:
Unit test
Integration test
Documentation
How to test changes / Special notes to the reviewer: