Skip to content

Commit 8bef583

Browse files
Merge pull request #18195 from openshift-cherrypick-robot/cherry-pick-18178-to-v4.5
[v4.5] Quadlet - do not set log-driver by default
2 parents 091706e + 5de2a13 commit 8bef583

File tree

7 files changed

+5
-15
lines changed

7 files changed

+5
-15
lines changed

docs/source/markdown/podman-systemd.unit.5.md

-4
Original file line numberDiff line numberDiff line change
@@ -295,8 +295,6 @@ This key can be listed multiple times.
295295
Set the log-driver Podman should use when running the container.
296296
Equivalent to the Podman `--log-driver` option.
297297

298-
The default value is `passthrough`.
299-
300298
### `Mount=`
301299

302300
Attach a filesystem mount to the container.
@@ -488,8 +486,6 @@ This key may be used multiple times
488486
Set the log-driver Podman should use when running the container.
489487
Equivalent to the Podman `--log-driver` option.
490488

491-
The default value is `passthrough`.
492-
493489
### `Network=`
494490

495491
Specify a custom network for the container. This has the same format as the `--network` option

pkg/systemd/quadlet/quadlet.go

+2-6
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,6 @@ const (
2727
XKubeGroup = "X-Kube"
2828
XNetworkGroup = "X-Network"
2929
XVolumeGroup = "X-Volume"
30-
31-
// Use passthough as the default log driver to output to Journal
32-
defaultLogDriver = "passthrough"
3330
)
3431

3532
// All the supported quadlet keys
@@ -1108,10 +1105,9 @@ func handlePublishPorts(unitFile *parser.UnitFile, groupName string, podman *Pod
11081105

11091106
func handleLogDriver(unitFile *parser.UnitFile, groupName string, podman *PodmanCmdline) {
11101107
logDriver, found := unitFile.Lookup(groupName, KeyLogDriver)
1111-
if !found {
1112-
logDriver = defaultLogDriver
1108+
if found {
1109+
podman.add("--log-driver", logDriver)
11131110
}
1114-
podman.add("--log-driver", logDriver)
11151111
}
11161112

11171113
func handleStorageSource(quadletUnitFile, serviceUnitFile *parser.UnitFile, source string) (string, error) {

test/e2e/quadlet/basepodman.container

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
## assert-podman-final-args run --name=systemd-%N --cidfile=%t/%N.cid --replace --rm --log-driver passthrough --cgroups=split --sdnotify=conmon -d localhost/imagename
1+
## assert-podman-final-args run --name=systemd-%N --cidfile=%t/%N.cid --replace --rm --cgroups=split --sdnotify=conmon -d localhost/imagename
22

33
[Container]
44
Image=localhost/imagename

test/e2e/quadlet/basic.container

-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
## assert-podman-args "--rm"
55
## assert-podman-args "--replace"
66
## assert-podman-args "-d"
7-
## assert-podman-args "--log-driver" "passthrough"
87
## assert-podman-args "--cgroups=split"
98
## assert-podman-args "--sdnotify=conmon"
109
## assert-key-is "Unit" "RequiresMountsFor" "%t/containers"

test/e2e/quadlet/basic.kube

-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
## assert-podman-final-args-regex .*/podman_test.*/quadlet/deployment.yml
44
## assert-podman-args "--replace"
55
## assert-podman-args "--service-container=true"
6-
## assert-podman-args "--log-driver" "passthrough"
76
## assert-podman-stop-args "kube"
87
## assert-podman-stop-args "down"
98
## assert-podman-stop-final-args-regex .*/podman_test.*/quadlet/deployment.yml

test/e2e/quadlet_test.go

+1-2
Original file line numberDiff line numberDiff line change
@@ -475,7 +475,6 @@ var _ = Describe("quadlet system generator", func() {
475475
"## assert-podman-final-args-regex .*/podman_test.*/quadlet/deployment.yml",
476476
"## assert-podman-args \"--replace\"",
477477
"## assert-podman-args \"--service-container=true\"",
478-
"## assert-podman-args \"--log-driver\" \"passthrough\"",
479478
"## assert-podman-stop-args \"kube\"",
480479
"## assert-podman-stop-args \"down\"",
481480
"## assert-podman-stop-final-args-regex .*/podman_test.*/quadlet/deployment.yml",
@@ -496,7 +495,7 @@ var _ = Describe("quadlet system generator", func() {
496495
"Type=notify",
497496
"NotifyAccess=all",
498497
"SyslogIdentifier=%N",
499-
fmt.Sprintf("ExecStart=/usr/local/bin/podman kube play --replace --service-container=true --log-driver passthrough %s/deployment.yml", quadletDir),
498+
fmt.Sprintf("ExecStart=/usr/local/bin/podman kube play --replace --service-container=true %s/deployment.yml", quadletDir),
500499
fmt.Sprintf("ExecStop=/usr/local/bin/podman kube down %s/deployment.yml", quadletDir),
501500
}
502501

test/system/252-quadlet.bats

+1
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,7 @@ EOF
177177
Image=$IMAGE
178178
Exec=sh -c "echo OUTPUT: \"\$FOOBAR\" \"\$BAR\""
179179
Environment="FOOBAR=Foo Bar" BAR=bar
180+
LogDriver=passthrough
180181
EOF
181182

182183
run_quadlet "$quadlet_file"

0 commit comments

Comments
 (0)