Merge pull request #17548 from vrothberg/fix-17482

kube play: only enforce passthrough in Quadlet
This commit is contained in:
OpenShift Merge Robot
2023-02-17 16:00:55 +01:00
committed by GitHub
5 changed files with 8 additions and 12 deletions

View File

@ -251,15 +251,6 @@ func play(cmd *cobra.Command, args []string) error {
return errors.New("--force may be specified only with --down")
}
// When running under Systemd use passthrough as the default log-driver.
// When doing so, 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
if !cmd.Flags().Changed(logDriverFlagName) && playOptions.ServiceContainer {
playOptions.LogDriver = define.PassthroughLogging
}
reader, err := readerFromArg(args[0])
if err != nil {
return err

View File

@ -793,6 +793,9 @@ func ConvertKube(kube *parser.UnitFile, isUser bool) (*parser.UnitFile, error) {
// Use a service container
"--service-container=true",
// We want output to the journal, so use the log driver.
"--log-driver", "passthrough",
)
if err := handleUserRemap(kube, KubeGroup, execStart, isUser, false); err != nil {

View File

@ -3,6 +3,7 @@
## assert-podman-final-args-regex .*/podman_test.*/quadlet/deployment.yml
## assert-podman-args "--replace"
## assert-podman-args "--service-container=true"
## assert-podman-args "--log-driver" "passthrough"
## assert-podman-stop-args "kube"
## assert-podman-stop-args "down"
## assert-podman-stop-final-args-regex .*/podman_test.*/quadlet/deployment.yml

View File

@ -393,6 +393,7 @@ var _ = Describe("quadlet system generator", func() {
"## assert-podman-final-args-regex .*/podman_test.*/quadlet/deployment.yml",
"## assert-podman-args \"--replace\"",
"## assert-podman-args \"--service-container=true\"",
"## assert-podman-args \"--log-driver\" \"passthrough\"",
"## assert-podman-stop-args \"kube\"",
"## assert-podman-stop-args \"down\"",
"## assert-podman-stop-final-args-regex .*/podman_test.*/quadlet/deployment.yml",
@ -413,7 +414,7 @@ var _ = Describe("quadlet system generator", func() {
"Type=notify",
"NotifyAccess=all",
"SyslogIdentifier=%N",
fmt.Sprintf("ExecStart=/usr/local/bin/podman kube play --replace --service-container=true %s/deployment.yml", quadletDir),
fmt.Sprintf("ExecStart=/usr/local/bin/podman kube play --replace --service-container=true --log-driver passthrough %s/deployment.yml", quadletDir),
fmt.Sprintf("ExecStop=/usr/local/bin/podman kube down %s/deployment.yml", quadletDir),
}

View File

@ -414,10 +414,10 @@ EOF
run_podman 125 container rm $service_container
is "$output" "Error: container .* is the service container of pod(s) .* and cannot be removed without removing the pod(s)"
# Verify that the log-driver for the Pod's containers is passthrough
# containers/podman/issues/17482: verify that the log-driver for the Pod's containers is NOT passthrough
for name in "a" "b"; do
run_podman container inspect test_pod-${name} --format "{{.HostConfig.LogConfig.Type}}"
is $output "passthrough"
assert $output != "passthrough"
done
# Add a simple `auto-update --dry-run` test here to avoid too much redundancy