summaryrefslogtreecommitdiff
path: root/libpod
diff options
context:
space:
mode:
authorUrvashi Mohnani <umohnani@redhat.com>2021-10-12 16:02:47 -0400
committerMatthew Heon <matthew.heon@pm.me>2021-10-19 15:56:35 -0400
commit92ed439d2252146220922bc1dd8cacfc4090a8c5 (patch)
treed16bb59da8d97eaeee6be6d7bbf8d153961532f0 /libpod
parent16fb4161a6853c047f40920adce43049cc428243 (diff)
downloadpodman-92ed439d2252146220922bc1dd8cacfc4090a8c5.tar.gz
podman-92ed439d2252146220922bc1dd8cacfc4090a8c5.tar.bz2
podman-92ed439d2252146220922bc1dd8cacfc4090a8c5.zip
Don't add image entrypoint to the generate kube yaml
If no entrypoint or command is set in the podman create command, and the image command or entrypoint is being used as the default, then do not add the image command or entrypoint to the generated kube yaml. Kubernetes knows to default to the image command and/or entrypoint settings when not defined in the kube yaml. Add and modify tests for this case. Signed-off-by: Urvashi Mohnani <umohnani@redhat.com>
Diffstat (limited to 'libpod')
-rw-r--r--libpod/kube.go4
1 files changed, 3 insertions, 1 deletions
diff --git a/libpod/kube.go b/libpod/kube.go
index 9c71c8ad6..72d2f8e96 100644
--- a/libpod/kube.go
+++ b/libpod/kube.go
@@ -481,7 +481,9 @@ func containerToV1Container(ctx context.Context, c *Container) (v1.Container, []
if err != nil {
return kubeContainer, kubeVolumes, nil, annotations, err
}
- if reflect.DeepEqual(imgData.Config.Cmd, kubeContainer.Command) {
+ // If the user doesn't set a command/entrypoint when creating the container with podman and
+ // is using the image command or entrypoint from the image, don't add it to the generated kube yaml
+ if reflect.DeepEqual(imgData.Config.Cmd, kubeContainer.Command) || reflect.DeepEqual(imgData.Config.Entrypoint, kubeContainer.Command) {
kubeContainer.Command = nil
}