mirror of
https://github.com/containers/podman.git
synced 2025-06-27 21:50:18 +08:00
Merge pull request #17548 from vrothberg/fix-17482
kube play: only enforce passthrough in Quadlet
This commit is contained in:
@ -251,15 +251,6 @@ func play(cmd *cobra.Command, args []string) error {
|
|||||||
return errors.New("--force may be specified only with --down")
|
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])
|
reader, err := readerFromArg(args[0])
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
|
@ -793,6 +793,9 @@ func ConvertKube(kube *parser.UnitFile, isUser bool) (*parser.UnitFile, error) {
|
|||||||
|
|
||||||
// Use a service container
|
// Use a service container
|
||||||
"--service-container=true",
|
"--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 {
|
if err := handleUserRemap(kube, KubeGroup, execStart, isUser, false); err != nil {
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
## assert-podman-final-args-regex .*/podman_test.*/quadlet/deployment.yml
|
## assert-podman-final-args-regex .*/podman_test.*/quadlet/deployment.yml
|
||||||
## assert-podman-args "--replace"
|
## assert-podman-args "--replace"
|
||||||
## assert-podman-args "--service-container=true"
|
## assert-podman-args "--service-container=true"
|
||||||
|
## assert-podman-args "--log-driver" "passthrough"
|
||||||
## assert-podman-stop-args "kube"
|
## assert-podman-stop-args "kube"
|
||||||
## assert-podman-stop-args "down"
|
## assert-podman-stop-args "down"
|
||||||
## assert-podman-stop-final-args-regex .*/podman_test.*/quadlet/deployment.yml
|
## assert-podman-stop-final-args-regex .*/podman_test.*/quadlet/deployment.yml
|
||||||
|
@ -393,6 +393,7 @@ var _ = Describe("quadlet system generator", func() {
|
|||||||
"## assert-podman-final-args-regex .*/podman_test.*/quadlet/deployment.yml",
|
"## assert-podman-final-args-regex .*/podman_test.*/quadlet/deployment.yml",
|
||||||
"## assert-podman-args \"--replace\"",
|
"## assert-podman-args \"--replace\"",
|
||||||
"## assert-podman-args \"--service-container=true\"",
|
"## assert-podman-args \"--service-container=true\"",
|
||||||
|
"## assert-podman-args \"--log-driver\" \"passthrough\"",
|
||||||
"## assert-podman-stop-args \"kube\"",
|
"## assert-podman-stop-args \"kube\"",
|
||||||
"## assert-podman-stop-args \"down\"",
|
"## assert-podman-stop-args \"down\"",
|
||||||
"## assert-podman-stop-final-args-regex .*/podman_test.*/quadlet/deployment.yml",
|
"## assert-podman-stop-final-args-regex .*/podman_test.*/quadlet/deployment.yml",
|
||||||
@ -413,7 +414,7 @@ var _ = Describe("quadlet system generator", func() {
|
|||||||
"Type=notify",
|
"Type=notify",
|
||||||
"NotifyAccess=all",
|
"NotifyAccess=all",
|
||||||
"SyslogIdentifier=%N",
|
"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),
|
fmt.Sprintf("ExecStop=/usr/local/bin/podman kube down %s/deployment.yml", quadletDir),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -414,10 +414,10 @@ EOF
|
|||||||
run_podman 125 container rm $service_container
|
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)"
|
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
|
for name in "a" "b"; do
|
||||||
run_podman container inspect test_pod-${name} --format "{{.HostConfig.LogConfig.Type}}"
|
run_podman container inspect test_pod-${name} --format "{{.HostConfig.LogConfig.Type}}"
|
||||||
is $output "passthrough"
|
assert $output != "passthrough"
|
||||||
done
|
done
|
||||||
|
|
||||||
# Add a simple `auto-update --dry-run` test here to avoid too much redundancy
|
# Add a simple `auto-update --dry-run` test here to avoid too much redundancy
|
||||||
|
Reference in New Issue
Block a user