Skip to content

Simpler code that logs containers#612

Merged
r2d4 merged 2 commits intoGoogleContainerTools:masterfrom
dgageot:simpler-logs
Jun 6, 2018
Merged

Simpler code that logs containers#612
r2d4 merged 2 commits intoGoogleContainerTools:masterfrom
dgageot:simpler-logs

Conversation

@dgageot
Copy link
Copy Markdown
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
// 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
Copy Markdown
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.

dgageot added 2 commits June 6, 2018 06:46
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
Copy Markdown
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.

3 participants