-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Kube Play: use passthrough as the default log-driver if service-container is set #16947
Kube Play: use passthrough as the default log-driver if service-container is set #16947
Conversation
cmd/podman/kube/play.go
Outdated
@@ -247,6 +247,14 @@ func play(cmd *cobra.Command, args []string) error { | |||
return errors.New("--force may be specified only with --down") | |||
} | |||
|
|||
if len(playOptions.LogDriver) == 0 { |
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 a better check would be whether the user overrode the default or not.
Something like:
if !cmd.Flags().Changed("log-driver") && playOptions.ServiceContainer {
playOptions.LogDriver = define.PassthroughLogging
}
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 didn't know this capability of the Flags
, thanks. Fixed
LGTM once @rhatdan 's comment is addressed. |
e65985a
to
3710c54
Compare
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 miss an explanation on why. Could you add a code comment and something to the commit message on why the defaults are changed?
Also: Why only for kube play
? Wouldn't it make sense to cover all systemd cases?
The Why is explained in the issue linked to this PR. I can add a comment copying the explanation given there.
I made the change only for |
Teachable moment: this is an antipattern. Linking to issues or external resources causes cognitive load on maintenance programmers. Any time a reviewer asks me "why", that's an opportunity to reflect on my code and realize that future maintainers will also wonder, and will appreciate a comment. |
…iner is set Reasoning --------- When the log-driver is passthrough, the journal socket is passed to the containers as-is which has two advantages: 1. journald can see who the actual sender of the log event is, rather than thinking everything comes from the conmon process 2. conmon will not have to copy all the log data Code Changes ------------ If log-driver was not set by the user and service-container is set use passthrough as the default log-driver Update the system tests - explicitly set logdriver in sdnotify and play tests - podman-kube template test: Verify the default log driver for service-container Signed-off-by: Ygal Blum <[email protected]>
3710c54
to
68fbebf
Compare
I've added the comment in both the code and the commit message as @vrothberg asked. |
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.
LGTM, thanks!
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: vrothberg, ygalblum The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
An alternative that would also work for ordinary containers is to check whether the
I forgot over the break that I suggested it 🤣 |
/lgtm |
/hold cancel |
If log-driver is not set, set to passthough is service-container is set otherwise use the global default
Update the system tests
Does this PR introduce a user-facing change?
Yes
Resolves: #16592