-
Notifications
You must be signed in to change notification settings - Fork 294
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
Migrate to CRI container log format #224
base: master
Are you sure you want to change the base?
Conversation
bf88c53
to
0480e9f
Compare
4f22570
to
64ac84a
Compare
core/logs.go
Outdated
return nil | ||
} | ||
|
||
type Log struct { |
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.
Instead of creating a fully new type, what do you think about extending the JSONLog type (since this is tied to that struct not moving anyway: https://github.com/moby/moby/blob/6ce5aa1cd5a46e02ffaa3fe0c794642b35601676/daemon/logger/jsonfilelog/jsonlog/jsonlog.go#L8) and keeping the CRIFormat()
method on the new type?
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, I think this is a good opportunity to kill IsCRISupportedLogDriver
in favor of moving the logic into this file, and perhaps supporting local
as well with an interface to different conversion functions.)
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 think that all sounds like a good plan. The only catch I see right now is waiting on those changes to get these tests running again.
What do you think about a comment and issue for a followup PR to replace this new type with JSONLog
? I'm also not seeing it exported in the docker API anywhere so that will need to be added.
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.
It's not in the API types (since it's not visible over the API), but it's in a public (non-internal/
) package and specifically, the type is in a minimal github.com/docker/docker/daemon/logger/jsonfilelog/jsonlog
package that has no non-std dependencies inside the larger github.com/docker/docker/daemon/logger/jsonfilelog
package for exactly this use-case.
I think it should be trivial to extend this PR, but I'm also fine with taking it earlier to unblock tests. In that case, I have a couple objections to the current design, but I'll need a bit more time to get them written out in a coherent way.
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.
@neersighted Take a look and see what you think. This required me to bump the docker lib a major version but the actual code changes needed were trivial. I pushed them up to make sure CI doesn't find anything.
I'm still thinking this will need to be organized differently. I'd love to hear your thoughts on the current design. I'm not convinced myself that there isn't a better way and I'd love to hear the feedback.
858c294
to
bb4f8f6
Compare
@@ -376,7 +377,7 @@ func recoverFromCreationConflictIfNeeded( | |||
client libdocker.DockerClientInterface, | |||
createConfig dockertypes.ContainerCreateConfig, | |||
err error, | |||
) (*dockercontainer.ContainerCreateCreatedBody, error) { | |||
) (*dockercontainer.CreateResponse, error) { |
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.
Changing to these CreateResponse
methods were the changes needed due to updating the docker/docker lib
return nil | ||
} | ||
|
||
type log struct { |
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'm thinking that it might make sense to put this log structure and its methods in its own file in the libdocker directory. I see this as a "wrapper" around the docker interface and that seems like what that folder is for.. but it doesn't seem like much is in there yet..
444dcb2
to
a8059b5
Compare
a8059b5
to
6731833
Compare
6731833
to
97f36f2
Compare
This change makes
cri-dockerd
output logs in CRI format instead of json-file format. This fixes the #213 and bumps integration test's pinned SHA so they now include these tests.cri-docker
previously had no interaction with the container logs. It would only create a symlink from the dockerd output path to the location expected by kube. This change now tails the logs created by dockerd, formats them to CRI, and creates a separate file in the log location expected by kube.