podman play kube apply correct log driver

The --log-driver flag was silently ignored by podman play kube. This
regression got introduced during the play kube rework.
Unfortunately the test for this was skipped for no good reason.

Fixes #10015

Signed-off-by: Paul Holzinger <paul.holzinger@web.de>
This commit is contained in:
Paul Holzinger
2021-04-15 18:24:22 +02:00
parent b074e80351
commit 1685c2dc36
3 changed files with 7 additions and 1 deletions

View File

@ -300,6 +300,7 @@ func (ic *ContainerEngine) playKubePod(ctx context.Context, podName string, podY
RestartPolicy: ctrRestartPolicy,
NetNSIsHost: p.NetNS.IsHost(),
SecretsManager: secretsManager,
LogDriver: options.LogDriver,
}
specGen, err := kube.ToSpecGen(ctx, &specgenOpts)
if err != nil {

View File

@ -98,6 +98,8 @@ type CtrSpecGenOptions struct {
NetNSIsHost bool
// SecretManager to access the secrets
SecretsManager *secrets.SecretsManager
// LogDriver which should be used for the container
LogDriver string
}
func ToSpecGen(ctx context.Context, opts *CtrSpecGenOptions) (*specgen.SpecGenerator, error) {
@ -115,6 +117,10 @@ func ToSpecGen(ctx context.Context, opts *CtrSpecGenOptions) (*specgen.SpecGener
s.Pod = opts.PodID
s.LogConfiguration = &specgen.LogConfig{
Driver: opts.LogDriver,
}
setupSecurityContext(s, opts.Container)
// Since we prefix the container name with pod name to work-around the uniqueness requirement,

View File

@ -1970,7 +1970,6 @@ MemoryReservation: {{ .HostConfig.MemoryReservation }}`})
})
It("podman play kube applies log driver to containers", func() {
Skip("need to verify images have correct packages for journald")
pod := getPod()
err := generateKubeYaml("pod", pod, kubeYaml)
Expect(err).To(BeNil())