-
Notifications
You must be signed in to change notification settings - Fork 14
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
container: support user defined logs endpoint #578
Conversation
Codecov Report
@@ Coverage Diff @@
## master #578 +/- ##
==========================================
- Coverage 35.57% 35.33% -0.25%
==========================================
Files 74 74
Lines 5374 5419 +45
==========================================
+ Hits 1912 1915 +3
- Misses 3189 3229 +40
- Partials 273 275 +2
Continue to review full report at Codecov.
|
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.
Excellent PR. but I have one comment that requires a change (regarding schema)
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 PR overall looks ok.
I think there is a way to make things a bit simpler though.
Instead of adding a new ContainerLogger interface, we could just use the WithStream method.
This methods takes any io.Writer
. This means any new logger implementation should just implement the io.Writer
interface.
The result would be something like
mw := io.MultiWriter(
logFile,
redisLogger,
// any other object that implement io.Writer...
)
container.NewTask(ctx,cio.NewCreator(cio.WithStreams(nil, mw, mw)))
Replace logs implementation, switching from custom internal handling to support WithStreams that containerd supports out-of-box. New implementation leverage this to io.Write class and remove the internal write process.
Latest implementation use the Still some improvement to fix and everything will be updated. |
- Move pkg/logger to pkg/container/logger since logger package are only for container purpose - Update name of struct inside logger package for shorter names - ContainerLoggerConsole -> Console - ContainerLoggerFile -> File - ContainerLoggerRedis -> Redis - NewContainerLoggers -> NewLoggers - NewContainerLoggerFile -> NewFile - NewContainerLoggerRedis -> NewRedis - NewContainerLoggerConsole -> NewConsole - Update provision to replace endpoint/channel with redis url for stdout and stderr - Update tfuser to support new provision fields - Removing --logs and --channel - Adding --stdout and --stderr options - Argument are now always using redis://host:port/channel format
From 0d6d56f commit message:
|
This PR allows user to forward container stdout/stderr to external endpoint. Right now, only redis is supported. You can define on container reservation a new field
logs
which contains information where to push logs:This endpoint is a reachable redis, and channel is a pub/sub where logs will be sent (one line at a time).