summaryrefslogtreecommitdiff
path: root/pkg/specgen/generate/kube/kube.go
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2021-05-27 21:18:05 +0200
committerGitHub <noreply@github.com>2021-05-27 21:18:05 +0200
commit3d8f37120d95c9a2d3293acdea6ab01a4c066806 (patch)
tree8c0cc5fd1fa335127a0158626f2d243f5cddf356 /pkg/specgen/generate/kube/kube.go
parent3223cb56dd1cbac1461d03eed6e0597540a89d0a (diff)
parentde293c9802a79f83eef83a0ca278ebb22cfb685d (diff)
downloadpodman-3d8f37120d95c9a2d3293acdea6ab01a4c066806.tar.gz
podman-3d8f37120d95c9a2d3293acdea6ab01a4c066806.tar.bz2
podman-3d8f37120d95c9a2d3293acdea6ab01a4c066806.zip
Merge pull request #10383 from rhatdan/kube
Handle image user and exposed ports in podman play kube
Diffstat (limited to 'pkg/specgen/generate/kube/kube.go')
-rw-r--r--pkg/specgen/generate/kube/kube.go14
1 files changed, 14 insertions, 0 deletions
diff --git a/pkg/specgen/generate/kube/kube.go b/pkg/specgen/generate/kube/kube.go
index 054388384..fb563f935 100644
--- a/pkg/specgen/generate/kube/kube.go
+++ b/pkg/specgen/generate/kube/kube.go
@@ -12,6 +12,7 @@ import (
"github.com/containers/common/pkg/secrets"
ann "github.com/containers/podman/v3/pkg/annotations"
"github.com/containers/podman/v3/pkg/specgen"
+ "github.com/containers/podman/v3/pkg/specgen/generate"
"github.com/containers/podman/v3/pkg/util"
spec "github.com/opencontainers/runtime-spec/specs-go"
"github.com/pkg/errors"
@@ -182,6 +183,19 @@ func ToSpecGen(ctx context.Context, opts *CtrSpecGenOptions) (*specgen.SpecGener
if imageData.Config.WorkingDir != "" {
s.WorkDir = imageData.Config.WorkingDir
}
+ if s.User == "" {
+ s.User = imageData.Config.User
+ }
+
+ exposed, err := generate.GenExposedPorts(imageData.Config.ExposedPorts)
+ if err != nil {
+ return nil, err
+ }
+
+ for k, v := range s.Expose {
+ exposed[k] = v
+ }
+ s.Expose = exposed
// Pull entrypoint and cmd from image
s.Entrypoint = imageData.Config.Entrypoint
s.Command = imageData.Config.Cmd