Skip to content
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

Simpler code that logs containers #612

Merged
merged 2 commits into from Jun 6, 2018

Conversation

dgageot
Copy link
Contributor

@dgageot dgageot commented May 28, 2018

@r2d4 I think this change is safe but I'd like your feedback.

@dgageot dgageot force-pushed the simpler-logs branch 5 times, most recently from c9d0bab to 2d29534 Compare June 2, 2018 07:13
@r2d4 r2d4 added the kokoro:run runs the kokoro jobs on a PR label Jun 4, 2018
@@ -104,9 +104,6 @@ func (a *LogAggregator) Start(ctx context.Context) error {
// 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 {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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>
@kokoro-team kokoro-team removed the kokoro:run runs the kokoro jobs on a PR label Jun 6, 2018
@dgageot
Copy link
Contributor Author

dgageot commented Jun 6, 2018

@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 r2d4 merged commit 1df51de into GoogleContainerTools:master Jun 6, 2018
@dgageot dgageot deleted the simpler-logs branch December 28, 2018 07:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants