Simpler code that logs containers#612
Merged
r2d4 merged 2 commits intoGoogleContainerTools:masterfrom Jun 6, 2018
Merged
Conversation
c9d0bab to
2d29534
Compare
r2d4
reviewed
Jun 4, 2018
| // nolint: interfacer | ||
| func (a *LogAggregator) streamLogs(ctx context.Context, client corev1.CoreV1Interface, pod *v1.Pod) error { | ||
| pods := client.Pods(pod.Namespace) | ||
| if err := WaitForPodReady(pods, pod.Name); err != nil { |
Contributor
There was a problem hiding this comment.
I still think theres a race condition here. Haven't been able to reproduce it yet but I do think it exists. The pod can be modified and send an event, but the container hasn't restarted yet. I don't believe that it happens atomically.
The outer loop will retry each time a pod is Modified and the code makes sure a container is not logged twice. Signed-off-by: David Gageot <david@gageot.net>
Signed-off-by: David Gageot <david@gageot.net>
Contributor
Author
|
@r2d4 I believe a watch event will always be received each time a pod's container is actually started. And from that point, the logs can be attached. |
r2d4
approved these changes
Jun 6, 2018
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
@r2d4 I think this change is safe but I'd like your feedback.