-
Notifications
You must be signed in to change notification settings - Fork 244
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
Fix sync when the pod gets re-created #2811
Fix sync when the pod gets re-created #2811
Conversation
Signed-off-by: John Collier <John.J.Collier@ibm.com>
Signed-off-by: John Collier <John.J.Collier@ibm.com>
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.
We can probably use the pod retrieved after creating component?
// Wait for Pod to be in running state otherwise we can't sync data to it. | ||
pod, err := a.Client.WaitAndGetPod(watchOptions, corev1.PodRunning, "Waiting for component to start") | ||
pod, err := a.waitAndGetComponentPod(false) |
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.
Can we just use the pod retrieved above after createOrUpdateComponent and rollout check https://github.com/openshift/odo/pull/2811/files#diff-825a1a88d75e789899c58e89a79eb767R73?
Because that is essentially the new pod, we dont necessarily need to retrieve it again here. You can probably skip the if condition if componentExists
and initialize podName := ""
and you wont need this retrieval here.
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.
The object returned from WaitForDeploymentRollout
is a Deployment which we can't get the pod name from directly, unfortunately.
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.
yep sorry, my bad. I like the change and i confirmed the fix, thanks! 👍
@johnmcollier #2735 was merged, you will need to rebase the PR |
Signed-off-by: John Collier <John.J.Collier@ibm.com>
Codecov Report
@@ Coverage Diff @@
## master #2811 +/- ##
==========================================
+ Coverage 43.46% 43.50% +0.04%
==========================================
Files 94 94
Lines 8601 8618 +17
==========================================
+ Hits 3738 3749 +11
- Misses 4512 4518 +6
Partials 351 351
Continue to review full report at Codecov.
|
@johnmcollier ok, make sense. @maysunfaisal do we have an open issue for this? or are you planning to send the test pr directly ? ATM i would say let create an open issue for integration test for devfile exec and mark this pr test may be in the task list of devfile exec test overage, so that we won't forget to add this scenario. WDYT ? |
/test v4.3-integration-e2e-benchmark |
As long as we are using /approve |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: kadel The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
@amitkrout I have opened an issue here #2818 |
@kadel Good question! I was finding that the (On a side note: I'm note sure why the generation field would change when nothing in the spec changed, but that's what I observed)
|
we need to cover this scenario with integration test |
fixes look good, thx for the change |
@kadel Yeah, agreed. Maysun's been working on integration tests for the devfile exec scenario and already has this scenario covered in his tests, so that's why I left it out of this PR. |
yep thats how this issue was discovered. |
/test ci/prow/v4.3-integration-e2e-benchmark |
/test v4.3-integration-e2e-benchmark |
/retest Please review the full test history for this PR and help us cut down flakes. |
3 similar comments
/retest Please review the full test history for this PR and help us cut down flakes. |
/retest Please review the full test history for this PR and help us cut down flakes. |
/retest Please review the full test history for this PR and help us cut down flakes. |
What type of PR is this?
/kind bug
What does does this PR do / why we need it:
This PR fixes the issue seen in #2807, where if something in the devfile changed that resulted in a new pod, the source code would get lost (as the emptyDir volume went away). Odo wouldn't detect this and wouldn't do a full sync, only a sync of the files that changed on the user's disk.
To fix this, if the component already exists, this PR compares the pod name before and after the call to
a.createOrUpdateComponent
. If the pod names are different, the pod has been re-created and a full sync is needed.Which issue(s) this PR fixes:
Fixes #2807
How to test changes / Special notes to the reviewer:
odo push
odo push
again, verify the entire source code is where it should be on the container(s)@maysunfaisal is working on integration tests for devfile exec that will have this scenario covered