diff options
author | Valentin Rothberg <rothberg@redhat.com> | 2021-02-03 16:36:46 +0100 |
---|---|---|
committer | Valentin Rothberg <rothberg@redhat.com> | 2021-02-04 12:34:35 +0100 |
commit | c995b54607a53d692ea2491771233895ff2c75a7 (patch) | |
tree | ec37c719afbf424fd7b806fe0e7f8f283b981d3a /libpod/kube.go | |
parent | 4ce8b1281e69b55b6024e87f2dec06638c678f10 (diff) | |
download | podman-c995b54607a53d692ea2491771233895ff2c75a7.tar.gz podman-c995b54607a53d692ea2491771233895ff2c75a7.tar.bz2 podman-c995b54607a53d692ea2491771233895ff2c75a7.zip |
generate kube: handle entrypoint
The spec of a Kube Container has a `Command` and `Args`. While both are
slices, the `Command` is the counterpart of the entrypoint of a libpod
container. Kube is also happily accepting the arguments to as following
items in the slice but it's cleaner to move those to `Args`.
Fixes: #9211
Signed-off-by: Valentin Rothberg <rothberg@redhat.com>
Diffstat (limited to 'libpod/kube.go')
-rw-r--r-- | libpod/kube.go | 21 |
1 files changed, 10 insertions, 11 deletions
diff --git a/libpod/kube.go b/libpod/kube.go index bf314b9a3..f9ead027d 100644 --- a/libpod/kube.go +++ b/libpod/kube.go @@ -353,22 +353,21 @@ func containerToV1Container(c *Container) (v1.Container, []v1.Volume, *v1.PodDNS return kubeContainer, kubeVolumes, nil, err } - containerCommands := c.Command() - kubeContainer.Name = removeUnderscores(c.Name()) + // Handle command and arguments. + if ep := c.Entrypoint(); len(ep) > 0 { + // If we have an entrypoint, set the container's command as + // arguments. + kubeContainer.Command = ep + kubeContainer.Args = c.Command() + } else { + kubeContainer.Command = c.Command() + } + kubeContainer.Name = removeUnderscores(c.Name()) _, image := c.Image() kubeContainer.Image = image kubeContainer.Stdin = c.Stdin() - // prepend the entrypoint of the container to command - if ep := c.Entrypoint(); len(c.Entrypoint()) > 0 { - ep = append(ep, containerCommands...) - containerCommands = ep - } - kubeContainer.Command = containerCommands - // TODO need to figure out how we handle command vs entry point. Kube appears to prefer entrypoint. - // right now we just take the container's command - //container.Args = args kubeContainer.WorkingDir = c.WorkingDir() kubeContainer.Ports = ports // This should not be applicable |