Skip to content

Commit

Permalink
Merge pull request containers#16731 from ygalblum/quadlet_syslogident…
Browse files Browse the repository at this point in the history
…ifier

Quadlet Kube: Set SyslogIdentifier if was not set
  • Loading branch information
openshift-merge-robot authored Dec 5, 2022
2 parents 3ed4482 + d61618a commit a9c1fe2
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 1 deletion.
4 changes: 4 additions & 0 deletions pkg/systemd/quadlet/quadlet.go
Original file line number Diff line number Diff line change
Expand Up @@ -638,6 +638,10 @@ func ConvertKube(kube *parser.UnitFile) (*parser.UnitFile, error) {
"Type", "notify",
"NotifyAccess", "all")

if !kube.HasKey(ServiceGroup, "SyslogIdentifier") {
service.Set(ServiceGroup, "SyslogIdentifier", "%N")
}

execStart := NewPodmanCmdline("kube", "play")

execStart.add(
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/quadlet/basic.kube
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
## assert-key-is "Service" "Type" "notify"
## assert-key-is "Service" "NotifyAccess" "all"
## assert-key-is "Service" "Environment" "PODMAN_SYSTEMD_UNIT=%n"

## assert-key-is "Service" "SyslogIdentifier" "%N"

[Kube]
Yaml=deployment.yml
20 changes: 20 additions & 0 deletions test/e2e/quadlet/syslog.identifier.kube
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
## assert-podman-args "kube"
## assert-podman-args "play"
## assert-podman-final-args deployment.yml
## assert-podman-args "--replace"
## assert-podman-args "--service-container=true"
## assert-podman-stop-args "kube"
## assert-podman-stop-args "down"
## assert-podman-stop-final-args deployment.yml
## assert-key-is "Unit" "RequiresMountsFor" "%t/containers"
## assert-key-is "Service" "KillMode" "mixed"
## assert-key-is "Service" "Type" "notify"
## assert-key-is "Service" "NotifyAccess" "all"
## assert-key-is "Service" "Environment" "PODMAN_SYSTEMD_UNIT=%n"
## assert-key-is "Service" "SyslogIdentifier" "mytest"

[Service]
SyslogIdentifier=mytest

[Kube]
Yaml=deployment.yml
1 change: 1 addition & 0 deletions test/e2e/quadlet_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -322,6 +322,7 @@ var _ = Describe("quadlet system generator", func() {
Entry("uid.volume", "uid.volume"),

Entry("Basic kube", "basic.kube"),
Entry("Syslog Identifier", "syslog.identifier.kube"),
)

})

0 comments on commit a9c1fe2

Please sign in to comment.