Skip to content

Commit

Permalink
kube play: only enforce passthrough in Quadlet
Browse files Browse the repository at this point in the history
Only enforce the passthrough log driver for Quadlet. Commit 68fbebf
introduced a regression on the `podman-kube@` template as `podman logs`
stopped working and settings from containers.conf were ignored.

Fixes: containers#17482
Signed-off-by: Valentin Rothberg <[email protected]>
  • Loading branch information
vrothberg authored and openshift-cherrypick-robot committed Feb 20, 2023
1 parent 0b38633 commit 9ca3d1c
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 12 deletions.
9 changes: 0 additions & 9 deletions cmd/podman/kube/play.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 3 additions & 0 deletions pkg/systemd/quadlet/quadlet.go
Original file line number Diff line number Diff line change
Expand Up @@ -745,6 +745,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 {
Expand Down
1 change: 1 addition & 0 deletions test/e2e/quadlet/basic.kube
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
## assert-podman-final-args-regex /tmp/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 /tmp/podman_test.*/quadlet/deployment.yml
Expand Down
3 changes: 2 additions & 1 deletion test/e2e/quadlet_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -393,6 +393,7 @@ var _ = Describe("quadlet system generator", func() {
"## assert-podman-final-args-regex /tmp/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 /tmp/podman_test.*/quadlet/deployment.yml",
Expand All @@ -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),
}

Expand Down
4 changes: 2 additions & 2 deletions test/system/250-systemd.bats
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 9ca3d1c

Please sign in to comment.